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 <[email protected]>
Acked-by: Stefan Reinauer <[email protected]>



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;
 }
 


--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to