arjitkumar / rpms / ftp

Forked from rpms/ftp 5 years ago
Clone

Blame SOURCES/netkit-ftp-0.17-chkmalloc.patch

09d58c
diff -up netkit-ftp-0.17/ftp/ruserpass.c.chkmalloc netkit-ftp-0.17/ftp/ruserpass.c
09d58c
--- netkit-ftp-0.17/ftp/ruserpass.c.chkmalloc	2008-12-01 11:54:15.000000000 +0100
09d58c
+++ netkit-ftp-0.17/ftp/ruserpass.c	2008-12-01 11:56:06.000000000 +0100
09d58c
@@ -137,7 +137,8 @@ next:
09d58c
 			if (token()) {
09d58c
 				if (*aname == 0) { 
09d58c
 					*aname = malloc((unsigned) strlen(tokval) + 1);
09d58c
-					(void) strcpy(*aname, tokval);
09d58c
+					if (*aname != NULL)
09d58c
+						(void) strcpy(*aname, tokval);
09d58c
 				} else {
09d58c
 					if (strcmp(*aname, tokval))
09d58c
 						goto next;
09d58c
@@ -158,7 +159,8 @@ next:
09d58c
 			}
09d58c
 			if (token() && *apass == 0) {
09d58c
 				*apass = malloc((unsigned) strlen(tokval) + 1);
09d58c
-				(void) strcpy(*apass, tokval);
09d58c
+				if (*apass != NULL)
09d58c
+					(void) strcpy(*apass, tokval);
09d58c
 			}
09d58c
 			break;
09d58c
 		case ACCOUNT:
09d58c
@@ -170,7 +172,8 @@ next:
09d58c
 			}
09d58c
 			if (token() && *aacct == 0) {
09d58c
 				*aacct = malloc((unsigned) strlen(tokval) + 1);
09d58c
-				(void) strcpy(*aacct, tokval);
09d58c
+				if (*aacct != NULL)
09d58c
+					(void) strcpy(*aacct, tokval);
09d58c
 			}
09d58c
 			break;
09d58c
 		case MACDEF: