diff options
author | Stefan Reinauer <stepan@coresystems.de> | 2009-01-26 00:57:54 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2009-01-26 00:57:54 +0000 |
commit | ac29d61a454f0562c5c63ea1f5e14f9068904bf0 (patch) | |
tree | ad59cd56664635a14298fe719a4305c5f289cdf0 /payloads/libpayload | |
parent | 8c4421ddbdd6f4fec3de2fa431d42f0421a758d1 (diff) | |
download | coreboot-ac29d61a454f0562c5c63ea1f5e14f9068904bf0.tar.xz |
fix a potential null pointer reference in strdup (as found by Patrick Georgi)
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3902 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload')
-rw-r--r-- | payloads/libpayload/libc/string.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/payloads/libpayload/libc/string.c b/payloads/libpayload/libc/string.c index 9502acfa6e..b9ecb907f6 100644 --- a/payloads/libpayload/libc/string.c +++ b/payloads/libpayload/libc/string.c @@ -212,10 +212,10 @@ char *strdup(const char *s) 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; } |