aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-30 16:08:40 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-30 16:08:40 +0100
commitddb45e9d60b7174fe5fb1ca8ab1478b4ad0fdf03 (patch)
tree59c4713838407c6be1103f2ccb193716f5eb8ce6 /src/libmime
parent6644ea293127bdb8a4aaddb8009f8212e95d83a4 (diff)
downloadrspamd-ddb45e9d60b7174fe5fb1ca8ab1478b4ad0fdf03.tar.gz
rspamd-ddb45e9d60b7174fe5fb1ca8ab1478b4ad0fdf03.zip
Initialize image structure to avoid corruption.
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/images.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libmime/images.c b/src/libmime/images.c
index 30150c335..30fe2cb6f 100644
--- a/src/libmime/images.c
+++ b/src/libmime/images.c
@@ -102,7 +102,7 @@ process_png_image (struct rspamd_task *task, GByteArray *data)
return NULL;
}
- img = rspamd_mempool_alloc (task->task_pool, sizeof (struct rspamd_image));
+ img = rspamd_mempool_alloc0 (task->task_pool, sizeof (struct rspamd_image));
img->type = IMAGE_TYPE_PNG;
img->data = data;
@@ -124,7 +124,7 @@ process_jpg_image (struct rspamd_task *task, GByteArray *data)
gsize remain;
struct rspamd_image *img;
- img = rspamd_mempool_alloc (task->task_pool, sizeof (struct rspamd_image));
+ img = rspamd_mempool_alloc0 (task->task_pool, sizeof (struct rspamd_image));
img->type = IMAGE_TYPE_JPG;
img->data = data;
@@ -158,7 +158,7 @@ process_gif_image (struct rspamd_task *task, GByteArray *data)
return NULL;
}
- img = rspamd_mempool_alloc (task->task_pool, sizeof (struct rspamd_image));
+ img = rspamd_mempool_alloc0 (task->task_pool, sizeof (struct rspamd_image));
img->type = IMAGE_TYPE_GIF;
img->data = data;
@@ -178,14 +178,12 @@ process_bmp_image (struct rspamd_task *task, GByteArray *data)
gint32 t;
guint8 *p;
-
-
if (data->len < 28) {
msg_info ("bad bmp detected (maybe striped): <%s>", task->message_id);
return NULL;
}
- img = rspamd_mempool_alloc (task->task_pool, sizeof (struct rspamd_image));
+ img = rspamd_mempool_alloc0 (task->task_pool, sizeof (struct rspamd_image));
img->type = IMAGE_TYPE_BMP;
img->data = data;
p = data->data + 18;