From: Emanuele Giaquinta Date: Sun, 18 Jul 2010 21:09:06 +0000 (+0100) Subject: Skip 'attachments' directive if minor type is not a valid regexp X-Git-Tag: mutt-1-5-21-rel~61 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7953b30ab2889d59b5ddd96c2ff0f4fb7b618402;p=mutt Skip 'attachments' directive if minor type is not a valid regexp --- diff --git a/init.c b/init.c index 399153c2..56664776 100644 --- a/init.c +++ b/init.c @@ -916,6 +916,7 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata, BUFFER *err) char *p; char *tmpminor; int len; + int ret; /* Find the last item in the list that data points to. */ lastp = NULL; @@ -965,10 +966,19 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata, BUFFER *err) tmpminor[len+2] = '\0'; a->major_int = mutt_check_mime_type(a->major); - regcomp(&a->minor_rx, tmpminor, REG_ICASE|REG_EXTENDED); + ret = regcomp(&a->minor_rx, tmpminor, REG_ICASE|REG_EXTENDED); FREE(&tmpminor); + if (ret) + { + regerror(ret, &a->minor_rx, err->data, err->dsize); + regfree(&a->minor_rx); + FREE(&a->major); + FREE(&a); + return -1; + } + dprint(5, (debugfile, "parse_attach_list: added %s/%s [%d]\n", a->major, a->minor, a->major_int));