diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-12-05 00:09:33 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-12-05 00:09:33 +0000 |
commit | 86e730e54fbb3348b60bf8d8279ba1100e46f66c (patch) | |
tree | fdc1f0faeef8261c3d98b02a7cd17fd125c6b9aa /src | |
parent | b74e1ee5ae045eb5b61592d374f6cdf3011818be (diff) | |
download | rspamd-86e730e54fbb3348b60bf8d8279ba1100e46f66c.tar.gz rspamd-86e730e54fbb3348b60bf8d8279ba1100e46f66c.zip |
Do not actually allow to set zero size to statfiles.
Diffstat (limited to 'src')
-rw-r--r-- | src/statfile.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/statfile.c b/src/statfile.c index 9930e0fe0..b5d467426 100644 --- a/src/statfile.c +++ b/src/statfile.c @@ -307,11 +307,14 @@ statfile_pool_open (statfile_pool_t * pool, gchar *filename, size_t size, gboole } memory_pool_lock_mutex (pool->lock); - if (!forced && abs (st.st_size - size) > (gint)sizeof (struct stat_file)) { + if (!forced && size > sizeof (struct stat_file)) { memory_pool_unlock_mutex (pool->lock); msg_warn ("need to reindex statfile old size: %Hz, new size: %Hz", st.st_size, size); return statfile_pool_reindex (pool, filename, st.st_size, size); } + else if (size < sizeof (struct stat_file)) { + msg_err ("requested to shrink statfile to %Hz but it is too small", size); + } new_file = &pool->files[pool->opened++]; bzero (new_file, sizeof (stat_file_t)); |