diff options
author | Jordan Crouse <jordan.crouse@amd.com> | 2008-04-25 23:07:39 +0000 |
---|---|---|
committer | Jordan Crouse <jordan.crouse@amd.com> | 2008-04-25 23:07:39 +0000 |
commit | c781584936361a921a9f1f6b0491341aaae5c2b8 (patch) | |
tree | 6464ff50b8b2e0a043bc9c388f4ce6d46a7a9928 /payloads/libpayload/libc | |
parent | 20ce60c9aa8a2f5548ec8ab8bd248ef2067b27ae (diff) | |
download | coreboot-c781584936361a921a9f1f6b0491341aaae5c2b8.tar.xz |
libpayload: Add the null terminator to the end of the duplicated string
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Acked-by: Myles Watson <mylesgw@gmail.com>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3268 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/libc')
-rw-r--r-- | payloads/libpayload/libc/string.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/payloads/libpayload/libc/string.c b/payloads/libpayload/libc/string.c index 1e9b8bc01c..e86f2c924a 100644 --- a/payloads/libpayload/libc/string.c +++ b/payloads/libpayload/libc/string.c @@ -173,11 +173,12 @@ char *strchr(const char *s, int c) char *strdup(const char *s) { int n = strlen(s); - char *p = malloc(n); + char *p = malloc(n + 1); if (p != NULL) strncpy(p, s, n); + p[n] = 0; return p; } |