[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sat May 23 02:31:55 UTC 2020


The branch, master has been updated
       via  d7212df0 A little more safety in negotiate_checksum().
      from  a28bc3eb Promoting xxhash support.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d7212df0f134ac82f9afb46d478ab3ac1511c61b
Author: Wayne Davison <wayne at opencoder.net>
Date:   Fri May 22 19:26:30 2020 -0700

    A little more safety in negotiate_checksum().

-----------------------------------------------------------------------

Summary of changes:
 checksum.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/checksum.c b/checksum.c
index 17a9507a..a21222d4 100644
--- a/checksum.c
+++ b/checksum.c
@@ -187,21 +187,24 @@ void negotiate_checksum(int f_in, int f_out, const char *csum_list, int saw_fail
 		if (saw_fail && !len)
 			len = strlcpy(sumbuf, "FAIL", sizeof sumbuf);
 		csum_list = sumbuf;
-	} else
+	} else {
+		memset(saw, 0, CSUM_SAW_BUFLEN);
 		csum_list = NULL;
+	}
 
 	if (!csum_list || !*csum_list) {
 		struct csum_struct *cs;
-		for (tok = sumbuf, cs = valid_checksums, len = 0; cs->name; cs++) {
+		int cnt = 0;
+		for (cs = valid_checksums, len = 0; cs->name; cs++) {
 			if (cs->num == CSUM_NONE)
 				continue;
-			if (tok != sumbuf)
-				*tok++ = ' ';
-			tok += strlcpy(tok, cs->name, sizeof sumbuf - (tok - sumbuf));
-			saw[cs->num] = ++len;
+			if (len)
+				sumbuf[len++]= ' ';
+			len += strlcpy(sumbuf+len, cs->name, sizeof sumbuf - len);
+			if (len >= (int)sizeof sumbuf - 1)
+				exit_cleanup(RERR_UNSUPPORTED); /* IMPOSSIBLE... */
+			saw[cs->num] = ++cnt;
 		}
-		*tok = '\0';
-		len = tok - sumbuf;
 	}
 
 	/* Each side sends their list of valid checksum names to the other side and


-- 
The rsync repository.



More information about the rsync-cvs mailing list