mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-04-25 08:39:25 -04:00
Fixed a bug in strlcat() where it would not properly detect a no-change
condition if called with an initial string longer than the specified size limit (due to an unsigned var's inability to go negative).
This commit is contained in:
@@ -138,10 +138,9 @@
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user