[coreboot] r3902 - trunk/payloads/libpayload/libc

svn at coreboot.org svn at coreboot.org
Mon Jan 26 01:57:54 CET 2009


Author: stepan
Date: 2009-01-26 01:57:54 +0100 (Mon, 26 Jan 2009)
New Revision: 3902

Modified:
   trunk/payloads/libpayload/libc/string.c
Log:
fix a potential null pointer reference in strdup (as found by Patrick Georgi)

Signed-off-by: Stefan Reinauer <stepan at coresystems.de>
Acked-by: Stefan Reinauer <stepan at coresystems.de>



Modified: trunk/payloads/libpayload/libc/string.c
===================================================================
--- trunk/payloads/libpayload/libc/string.c	2009-01-26 00:39:57 UTC (rev 3901)
+++ trunk/payloads/libpayload/libc/string.c	2009-01-26 00:57:54 UTC (rev 3902)
@@ -212,10 +212,10 @@
 	int n = strlen(s);
 	char *p = malloc(n + 1);
 
-	if (p != NULL)
+	if (p != NULL) {
 		strncpy(p, s, n);
-
-	p[n] = 0;
+		p[n] = 0;
+	}
 	return p;
 }
 





More information about the coreboot mailing list