rpms/rsh/devel netkit-rsh-0.17-rh473492.patch, NONE, 1.1 rsh.spec, 1.57, 1.58

Jan Görig jgorig at fedoraproject.org
Tue Jan 5 15:41:09 UTC 2010


Author: jgorig

Update of /cvs/pkgs/rpms/rsh/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17273

Modified Files:
	rsh.spec 
Added Files:
	netkit-rsh-0.17-rh473492.patch 
Log Message:
add check for return values (#473492)


netkit-rsh-0.17-rh473492.patch:
 rexec/rexec.c |   25 +++++++++++++++++++++++--
 rshd/rshd.c   |    6 +++++-
 2 files changed, 28 insertions(+), 3 deletions(-)

--- NEW FILE netkit-rsh-0.17-rh473492.patch ---
diff -up netkit-rsh-0.17/rexec/rexec.c.patch netkit-rsh-0.17/rexec/rexec.c
--- netkit-rsh-0.17/rexec/rexec.c.patch	2010-01-05 15:24:44.000000000 +0100
+++ netkit-rsh-0.17/rexec/rexec.c	2010-01-05 16:06:55.927098704 +0100
@@ -300,14 +300,29 @@ void parse_options(char *argv[], int arg
     {
     case 'l':
       if (optarg != NULL)
-	*user_name=strcpy((char *)malloc((strlen(optarg)+1)*sizeof(char)),optarg);
+      {
+        *user_name = malloc((strlen(optarg)+1)*sizeof(char));
+        if(*user_name == NULL)
+        {
+          fprintf(stderr, "%s: can't allocate memory!\n", argv[0]);
+          exit(1);
+        }
+        strcpy(*user_name,optarg);
+      }
       break;
     case 'p':
       if ( optarg!= NULL )
       {
         int passlen = strlen(optarg);
 
-	*passwd=strcpy((char *)malloc((passlen+1)*sizeof(char)),optarg);
+	*passwd = malloc((char *)malloc((passlen+1)*sizeof(char)));
+        if(*passwd == NULL)
+        {
+          fprintf(stderr, "%s: can't allocate memory!\n", argv[0]);
+          exit(1);
+        }
+        strcpy(*passwd,optarg);
+	
         for (ind = 0; ind < passlen; ++ind)
           optarg[ind] = '\0';
       }
@@ -356,6 +371,12 @@ void parse_options(char *argv[], int arg
   for ( ind = optind; ind < argc; ++ind)
     len += strlen(argv[ind])+1;
   *command = (char *) malloc((len+1)*sizeof(char));
+  if ( *command == NULL )
+  {
+    fprintf(stderr, "%s: can't allocate memory!\n", argv[0]);
+    exit(1);
+  }
+  
   **command = '\0';
   for ( ind = optind; ind < argc; ++ind) {
     if ( ind > optind ) {
diff -up netkit-rsh-0.17/rshd/rshd.c.patch netkit-rsh-0.17/rshd/rshd.c
--- netkit-rsh-0.17/rshd/rshd.c.patch	2010-01-05 15:24:44.000000000 +0100
+++ netkit-rsh-0.17/rshd/rshd.c	2010-01-05 15:46:39.718973390 +0100
@@ -562,7 +562,11 @@ doit(struct sockaddr_storage *fromp, soc
 	environ = envinit;
 
 	if (chdir(pwd->pw_dir) < 0) {
-		chdir("/");
+		if(chdir("/") < 0)
+		{
+			error("No remote directory and can't chdir to root.\n");
+			exit(1);
+		}
 		/*
 		 * error("No remote directory.\n");
 		 * exit(1);


Index: rsh.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rsh/devel/rsh.spec,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -p -r1.57 -r1.58
--- rsh.spec	17 Dec 2009 12:59:15 -0000	1.57
+++ rsh.spec	5 Jan 2010 15:41:09 -0000	1.58
@@ -1,7 +1,7 @@
 Summary: Clients for remote access commands (rsh, rlogin, rcp)
 Name: rsh
 Version: 0.17
-Release: 61%{?dist}
+Release: 62%{?dist}
 License: BSD
 Group: Applications/Internet
 
@@ -75,6 +75,7 @@ Patch36: netkit-rsh-0.17-longname.patch
 Patch37: netkit-rsh-0.17-arg_max.patch
 Patch38: netkit-rsh-0.17-rh448904.patch
 Patch39: netkit-rsh-0.17-rh461903.patch
+Patch40: netkit-rsh-0.17-rh473492.patch
 
 %description
 The rsh package contains a set of programs which allow users to run
@@ -139,6 +140,7 @@ from other machines
 %patch37 -p1 -b .arg_max
 %patch38 -p1 -b .rh448904
 %patch39 -p1 -b .rh461903
+%patch40 -p1 -b .rh473492
 
 # No, I don't know what this is doing in the tarball.
 rm -f rexec/rexec
@@ -208,6 +210,9 @@ rm -rf ${RPM_BUILD_ROOT}
 %{_mandir}/man8/*.8*
 
 %changelog
+* Tue Jan 5 2010 Jan Gorig  <jgorig redhat com> - 0.17-62
+- add check for return values (#473492)
+
 * Thu Dec 17 2009 Adam Tkac <atkac redhat com> - 0.17-61
 - include README and BUGS files as documentation (#226379)
 




More information about the fedora-extras-commits mailing list