diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2008-03-21 15:47:38 +0000 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2008-03-21 15:47:38 +0000 |
commit | 29014056e7fa3ee7a38c49d6de6924de60b9903c (patch) | |
tree | 08ebf5944aae01bfde437923e782cc3dab8055de | |
parent | 316e07fb04c4de11b8be717c73f9a80baf0fece6 (diff) |
Quickfix for libpayload's strcpy() to properly NUL-terminate strings (trivial).
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3184 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r-- | payloads/libpayload/libc/string.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/payloads/libpayload/libc/string.c b/payloads/libpayload/libc/string.c index bbe99933f0..ad0a17755a 100644 --- a/payloads/libpayload/libc/string.c +++ b/payloads/libpayload/libc/string.c @@ -130,8 +130,7 @@ int strncmp(const char *s1, const char *s2, int maxlen) char *strncpy(char *d, const char *s, int n) { - /* use +1 to get the null terminator */ - + /* Use +1 to get the NUL terminator. */ int max = n > strlen(s) + 1 ? strlen(s) + 1 : n; int i; @@ -143,7 +142,7 @@ char *strncpy(char *d, const char *s, int n) char *strcpy(char *d, const char *s) { - return strncpy(d, s, strlen(s)); + return strncpy(d, s, strlen(s) + 1); } char *strncat(char *d, const char *s, int n) |