projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
68cfbad
)
Fix bug in strlcpy() that could cause reading too much data from the
author
Ben Pfaff
<blp@cs.stanford.edu>
Fri, 29 Oct 2004 04:29:29 +0000
(
04:29
+0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Fri, 29 Oct 2004 04:29:29 +0000
(
04:29
+0000)
source string. Thanks to Jim Chow for reporting the bug and providing
the fix.
src/lib/string.c
patch
|
blob
|
history
diff --git
a/src/lib/string.c
b/src/lib/string.c
index 8971fae21b3c4d6da492b2e54614dbb3e6f8e058..89fa1f05c01f130bce10948d493a10cac6d29063 100644
(file)
--- 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';
}