]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix some more issues with HTTP maps
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 8 Jul 2017 08:45:57 +0000 (09:45 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 8 Jul 2017 08:45:57 +0000 (09:45 +0100)
src/libutil/map.c

index fad48aeab2fe9c7a53d76a0a56d5880553f0c0b6..edd4eaa1fc1249240954e8b8be43ee63636184ae 100644 (file)
@@ -512,6 +512,11 @@ http_map_finish (struct rspamd_http_connection *conn,
                }
 
 read_data:
+               if (cbd->data_len == 0) {
+                       msg_err_map ("cannot read empty map");
+                       goto err;
+               }
+
                g_assert (cbd->shmem_data != NULL);
 
                in = rspamd_shmem_xmap (cbd->shmem_data->shm_name, PROT_READ, &dlen);
@@ -537,6 +542,7 @@ read_data:
                cache_cbd = g_slice_alloc0 (sizeof (*cache_cbd));
                cache_cbd->shm = cbd->shmem_data;
                cache_cbd->map = map;
+               cache_cbd->data = cbd->data;
                cache_cbd->last_checked = cbd->data->last_checked;
                cache_cbd->gen = cbd->data->gen;
                MAP_RETAIN (cache_cbd->shm, "shmem_data");