From: Ben Pfaff Date: Fri, 29 Oct 2004 04:29:29 +0000 (+0000) Subject: Fix bug in strlcpy() that could cause reading too much data from the X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e44481130aa27aaf20c7755586e3413fdd8d9da1;p=pintos-anon Fix bug in strlcpy() that could cause reading too much data from the source string. Thanks to Jim Chow for reporting the bug and providing the fix. --- diff --git a/src/lib/string.c b/src/lib/string.c index 8971fae..89fa1f0 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -339,7 +339,7 @@ strlcpy (char *dst, const char *src, size_t size) { size_t dst_len = size - 1; if (src_len < dst_len) - src_len = dst_len; + dst_len = src_len; memcpy (dst, src, dst_len); dst[dst_len] = '\0'; }