commit f10990285c2825c97d24021e280c7c7627f8a5ff
parent e564bee669d6957b144d2e36f7938ec3a9a43c75
Author: Christoph Lohmann <20h@r-36.net>
Date: Mon, 7 Jan 2019 19:52:58 +0100
Fix segfault in checking for spaces, if header is empty.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mime.c b/mime.c
@@ -159,6 +159,7 @@ mime_decodeheaderext(char *value)
int len, slen;
len = strlen(value);
+
ret = memdupz(value, len);
work = memdupz(value, len);
@@ -258,6 +259,7 @@ mime_decodeheader(char *value)
char *work, *extp, *extw, *extb, *exte, *extr, *ret, *q1, *q2;
int vlen, rlen, elen, wasenc, i;
+ //printf("mime_decodeheader\n");
ret = NULL;
rlen = 0;
vlen = strlen(value);
@@ -308,7 +310,8 @@ mime_decodeheader(char *value)
free(work);
/* Remove any space character, like newline. */
- strnormalizespace(ret);
+ if (ret != NULL)
+ strnormalizespace(ret);
return ret;
}
@@ -352,6 +355,7 @@ mime_guessheader(char *value)
gcs = NULL;
//printf("mime_guessheader '%s'\n", value);
+
nvalue = value;
if (!strisascii(value)) {
/*