]> source.dussan.org Git - rspamd.git/commitdiff
* Fix reading of last block
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Tue, 20 Oct 2009 14:13:19 +0000 (18:13 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Tue, 20 Oct 2009 14:13:19 +0000 (18:13 +0400)
src/statfile.c

index e44af6c2baa89f216d563fedee5fe2356cde4446..d8eb7635ef64f14a6a9663fa64c02b712dcfbdc2 100644 (file)
@@ -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;