From: Vsevolod Stakhov Date: Tue, 20 Oct 2009 14:13:19 +0000 (+0400) Subject: * Fix reading of last block X-Git-Tag: 0.3.0~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de116af023c1bcabe862b222a1008d8dccee73c3;p=thirdparty%2Frspamd.git * Fix reading of last block --- diff --git a/src/statfile.c b/src/statfile.c index e44af6c2ba..d8eb7635ef 100644 --- a/src/statfile.c +++ b/src/statfile.c @@ -445,7 +445,7 @@ statfile_pool_get_block (statfile_pool_t * pool, stat_file_t * file, uint32_t h1 block = (struct stat_file_block *)c; for (i = 0; i < CHAIN_LENGTH; i++) { - if (i + blocknum > file->cur_section.length) { + if (i + blocknum >= file->cur_section.length) { break; } if (block->hash1 == h1 && block->hash2 == h2) { @@ -482,7 +482,7 @@ statfile_pool_set_block_common (statfile_pool_t * pool, stat_file_t * file, uint block = (struct stat_file_block *)c; for (i = 0; i < CHAIN_LENGTH; i++) { - if (i + blocknum > file->cur_section.length) { + if (i + blocknum >= file->cur_section.length) { /* Need to expire some block in chain */ msg_debug ("statfile_pool_set_block: chain %u is full, starting expire", blocknum); break;