Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed a bug in strlcat() where it would not properly detect a no-change
[rsync/rsync.git]
/
lib
/
compat.c
diff --git
a/lib/compat.c
b/lib/compat.c
index
a783a01
..
6dd2328
100644
(file)
--- a/
lib/compat.c
+++ b/
lib/compat.c
@@
-138,10
+138,9
@@
size_t len2 = strlen(s);
size_t ret = len1 + len2;
size_t len2 = strlen(s);
size_t ret = len1 + len2;
- if (len1+len2 >= bufsize) {
- len2 = bufsize - (len1+1);
- }
- if (len2 > 0) {
+ if (len1 < bufsize - 1) {
+ if (len2 >= bufsize - len1)
+ len2 = bufsize - len1 - 1;
memcpy(d+len1, s, len2);
d[len1+len2] = 0;
}
memcpy(d+len1, s, len2);
d[len1+len2] = 0;
}