From: Wayne Davison Date: Fri, 22 Apr 2011 18:31:29 +0000 (-0700) Subject: Fix a potential crash when trying to find a better block match. X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/813d5a25e307bf86169ac6f30b120c02ff116667 Fix a potential crash when trying to find a better block match. --- diff --git a/match.c b/match.c index 9da18a76..f327fd37 100644 --- a/match.c +++ b/match.c @@ -239,8 +239,9 @@ static void hash_search(int f,struct sum_struct *s, aligned_offset += s->blength; aligned_i++; } - if (offset == aligned_offset - || (sum == 0 && l == s->blength && aligned_offset + l <= len)) { + if ((offset == aligned_offset + || (sum == 0 && l == s->blength && aligned_offset + l <= len)) + && aligned_i < s->count) { if (i != aligned_i) { if (sum != s->sums[aligned_i].sum1 || l != s->sums[aligned_i].len