summaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2011-04-22 11:31:29 -0700
committerWayne Davison <wayned@samba.org>2011-04-22 16:06:06 -0700
commit813d5a25e307bf86169ac6f30b120c02ff116667 (patch)
tree0226cdead5e309a9de17cdebef4020f6fc5c48b0 /match.c
parent591c224584c04e0d6f58ece969946bd5472f7c89 (diff)
downloadrsync-813d5a25e307bf86169ac6f30b120c02ff116667.tar.gz
rsync-813d5a25e307bf86169ac6f30b120c02ff116667.tar.bz2
rsync-813d5a25e307bf86169ac6f30b120c02ff116667.zip
Fix a potential crash when trying to find a better block match.
Diffstat (limited to 'match.c')
-rw-r--r--match.c5
1 files changed, 3 insertions, 2 deletions
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