[coreboot] r3184 - trunk/payloads/libpayload/libc
svn at coreboot.org
svn at coreboot.org
Fri Mar 21 16:47:38 CET 2008
Author: uwe
Date: 2008-03-21 16:47:38 +0100 (Fri, 21 Mar 2008)
New Revision: 3184
Modified:
trunk/payloads/libpayload/libc/string.c
Log:
Quickfix for libpayload's strcpy() to properly NUL-terminate strings (trivial).
Signed-off-by: Uwe Hermann <uwe at hermann-uwe.de>
Acked-by: Uwe Hermann <uwe at hermann-uwe.de>
Modified: trunk/payloads/libpayload/libc/string.c
===================================================================
--- trunk/payloads/libpayload/libc/string.c 2008-03-20 21:19:50 UTC (rev 3183)
+++ trunk/payloads/libpayload/libc/string.c 2008-03-21 15:47:38 UTC (rev 3184)
@@ -130,8 +130,7 @@
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 *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)
More information about the coreboot
mailing list