commit 612b4635f36c5ad16c9c651416a3c85111dce99a
parent cc1288fba991ad4fe8b9d5fffe809565cb6c1585
Author: Christoph Lohmann <20h@r-36.net>
Date: Sun, 28 Oct 2018 17:57:51 +0100
Fix *$num handling for headers.
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/mime.c b/mime.c
@@ -538,7 +538,8 @@ mime_sanitizeparams(llist_t *params)
key = param->key;
klen = strlen(key);
- if (key[klen-1] == '*') {
+ //printf("key = %s\n", key);
+ if (key[klen-2] == '*') {
nvalue = mime_decodeparam((char *)param->data);
if (nvalue != NULL) {
//printf("decoded: %s\n", nvalue);
@@ -546,7 +547,8 @@ mime_sanitizeparams(llist_t *params)
param->data = nvalue;
param->datalen = strlen(nvalue)+1;
}
- key[--klen] = '\0';
+ key[klen-2] = '\0';
+ //printf("key after = %s\n", key);
}
nvalue = strrchr(param->key, '*');
@@ -825,6 +827,7 @@ mime_preparepart(mime_t *mime)
llistelem_t *hdr, *field;
llist_t *hdrf;
+ //printf("mime = %p\n", mime);
hdr = llist_ciget(mime->hdrs, "content-type");
if (hdr != NULL && hdr->data != NULL && strlen(hdr->data) > 0) {
//printf("content-type: %s\n", (char *)hdr->data);
@@ -984,6 +987,8 @@ mimeparsebufagain:
mimeparsebufbodyparse:
//printf("body parsing begins.\n");
mime = mime_preparepart(mime);
+ if (mime == NULL)
+ return NULL;
/*
* It is not a multipart message, so take the remainder