aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-02-27 03:12:26 +0000
committerWayne Davison <wayned@samba.org>2006-02-27 03:12:26 +0000
commitc638caa63eda76ac72aef2869b6cece4a23467f7 (patch)
treeb5f7f108e6f3e5c58701d2ccca16effb782a97fc /io.c
parentd775372a34565cd8d8e3920f536cd2cbbf0b57b8 (diff)
downloadandroid_external_rsync-c638caa63eda76ac72aef2869b6cece4a23467f7.tar.gz
android_external_rsync-c638caa63eda76ac72aef2869b6cece4a23467f7.tar.bz2
android_external_rsync-c638caa63eda76ac72aef2869b6cece4a23467f7.zip
In read_sum_head(): if we read a negative checksum count, die
with an error.
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/io.c b/io.c
index 8f8c5c21..475ac40f 100644
--- a/io.c
+++ b/io.c
@@ -948,6 +948,11 @@ int read_vstring(int f, char *buf, int bufsize)
void read_sum_head(int f, struct sum_struct *sum)
{
sum->count = read_int(f);
+ if (sum->count < 0) {
+ rprintf(FERROR, "Invalid checksum count %ld [%s]\n",
+ (long)sum->count, who_am_i());
+ exit_cleanup(RERR_PROTOCOL);
+ }
sum->blength = read_int(f);
if (sum->blength < 0 || sum->blength > MAX_BLOCK_SIZE) {
rprintf(FERROR, "Invalid block length %ld [%s]\n",