From 29014056e7fa3ee7a38c49d6de6924de60b9903c Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Fri, 21 Mar 2008 15:47:38 +0000 Subject: Quickfix for libpayload's strcpy() to properly NUL-terminate strings (trivial). Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3184 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- payloads/libpayload/libc/string.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'payloads/libpayload') 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) -- cgit v1.2.3