guint32 cd_offset, cd_size, comp_size, uncomp_size, processed = 0;
guint16 extra_len, fname_len, comment_len;
struct rspamd_archive *arch;
- struct rspamd_archive_file *f;
+ struct rspamd_archive_file *f = NULL;
/* Zip files have interesting data at the end of archive */
p = part->parsed_data.begin + part->parsed_data.len - 1;
}
folder_nstreams = g_alloca (sizeof (guint64) * num_folders);
+ memset (folder_nstreams, 0, sizeof (guint64) * num_folders);
while (p != NULL && p < end) {
/*
*/
proptype = *p;
- SZ_SKIP_BYTES(1);
if (p != NULL) {
+ SZ_SKIP_BYTES(1);
+
while (proptype != 0) {
SZ_READ_VINT(proplen);
RSPAMD_CHARSET_MAX_CONTENT, false);
/* 7bit stuff */
- if (strcmp (c1, "US-ASCII") == 0) {
+ if (c1 && strcmp (c1, "US-ASCII") == 0) {
c1 = NULL; /* Invalid - we have 8 bit there */
}
- if (strcmp (c2, "US-ASCII") == 0) {
+ if (c2 && strcmp (c2, "US-ASCII") == 0) {
c2 = NULL; /* Invalid - we have 8 bit there */
}
- if (strcmp (c3, "US-ASCII") == 0) {
- c2 = NULL; /* Invalid - we have 8 bit there */
+ if (c3 && strcmp (c3, "US-ASCII") == 0) {
+ c3 = NULL; /* Invalid - we have 8 bit there */
}
if (!c1) {
g_assert (part != NULL);
rspamd_mime_part_get_cte (task, part->raw_headers, part,
- !(part->ct->flags & RSPAMD_CONTENT_TYPE_MESSAGE));
+ part->ct && !(part->ct->flags & RSPAMD_CONTENT_TYPE_MESSAGE));
rspamd_mime_part_get_cd (task, part);
switch (part->cte) {
case RSPAMD_CTE_7BIT:
case RSPAMD_CTE_8BIT:
case RSPAMD_CTE_UNKNOWN:
- if (part->ct->flags & RSPAMD_CONTENT_TYPE_MISSING) {
+ if (part->ct && (part->ct->flags & RSPAMD_CONTENT_TYPE_MISSING)) {
if (part->cte != RSPAMD_CTE_7BIT) {
/* We have something that has a missing content-type,
* but it has non-7bit characters.
}
else {
msg_err_task ("invalid quoted-printable encoded part, assume 8bit");
- part->ct->flags |= RSPAMD_CONTENT_TYPE_BROKEN;
+ if (part->ct) {
+ part->ct->flags |= RSPAMD_CONTENT_TYPE_BROKEN;
+ }
part->cte = RSPAMD_CTE_8BIT;
memcpy (parsed->str, part->raw_data.begin, part->raw_data.len);
parsed->len = part->raw_data.len;
}
else {
msg_err_task ("invalid uuencoding in encoded part, assume 8bit");
- part->ct->flags |= RSPAMD_CONTENT_TYPE_BROKEN;
+ if (part->ct) {
+ part->ct->flags |= RSPAMD_CONTENT_TYPE_BROKEN;
+ }
part->cte = RSPAMD_CTE_8BIT;
parsed->len = MIN (part->raw_data.len, parsed->allocated);
memcpy (parsed->str, part->raw_data.begin, parsed->len);