From e44481130aa27aaf20c7755586e3413fdd8d9da1 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 29 Oct 2004 04:29:29 +0000 Subject: [PATCH] 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. --- src/lib/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'; } -- 2.30.2