summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2014-08-29 14:11:50 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2014-08-29 18:59:27 +0100
commit93cad488cb2c9a31aea345c8910a9f9c5815071c (patch)
tree52e1b1933631e97763d3f2df1b44f97ddc2037a1 /src
parent430f98cb1e35e925f6b3ca54375411ff67e8895b (diff)
Fix crash in mime acl when a parameter is zero-length
Diffstat (limited to 'src')
-rw-r--r--src/src/mime.c18
-rw-r--r--src/src/mime.h10
2 files changed, 17 insertions, 11 deletions
diff --git a/src/src/mime.c b/src/src/mime.c
index 95d3da472..ab701f2a6 100644
--- a/src/src/mime.c
+++ b/src/src/mime.c
@@ -620,12 +620,18 @@ NEXT_PARAM_SEARCH:
else
param_value = string_cat(param_value, &size, &ptr, q++, 1);
}
- param_value[ptr++] = '\0';
- param_value_len = ptr;
-
- param_value = rfc2047_decode(param_value, check_rfc2047_length, NULL, 32, &param_value_len, &q);
- debug_printf("Found %s MIME parameter in %s header, value is '%s'\n", mp->name, mime_header_list[i].name, param_value);
- *((uschar **)(mp->value)) = param_value;
+ if (param_value)
+ {
+ param_value[ptr++] = '\0';
+ param_value_len = ptr;
+
+ param_value = rfc2047_decode(param_value,
+ check_rfc2047_length, NULL, 32, &param_value_len, &q);
+ debug_printf("Found %s MIME parameter in %s header, "
+ "value is '%s'\n", mp->name, mime_header_list[i].name,
+ param_value);
+ }
+ *mp->value = param_value;
p += (mp->namelen + param_value_len + 1);
goto NEXT_PARAM_SEARCH;
}
diff --git a/src/src/mime.h b/src/src/mime.h
index abf68da26..af09f677d 100644
--- a/src/src/mime.h
+++ b/src/src/mime.h
@@ -40,15 +40,15 @@ static int mime_header_list_size = sizeof(mime_header_list)/sizeof(mime_header);
typedef struct mime_parameter {
- uschar *name;
- int namelen;
- void *value;
+ uschar * name;
+ int namelen;
+ uschar ** value;
} mime_parameter;
static mime_parameter mime_parameter_list[] = {
- { US"name=", 5, &mime_filename },
+ { US"name=", 5, &mime_filename },
{ US"filename=", 9, &mime_filename },
- { US"charset=", 8, &mime_charset },
+ { US"charset=", 8, &mime_charset },
{ US"boundary=", 9, &mime_boundary }
};