*/
char *
extract_name_value(char *name_suffix, char *value) {
- char *extracted_name_value = value;
- char *name_suffix_plus_quote = concat(name_suffix, "=\"", NULL);
- char *name_suffix_equals = strstr(value, name_suffix_plus_quote);
+ char *extracted_name_value;
+ char *name_suffix_plus_quote;
+ char *name_suffix_equals;
char *cp;
+ if (!value) {
+ return value;
+ }
+ extracted_name_value = value;
+ name_suffix_plus_quote = concat(name_suffix, "=\"", NULL);
+ name_suffix_equals = strstr(value, name_suffix_plus_quote);
mh_free0(&name_suffix_plus_quote);
if (name_suffix_equals) {
char *name_suffix_begin;
if (autosw && ct->c_type != CT_MESSAGE) {
/* First check for "filename" in Content-Disposition header */
filename = extract_name_value("filename", ct->c_dispo);
- if (strcmp(filename, ct->c_dispo)!=0) {
+ if (filename && strcmp(filename, ct->c_dispo)!=0) {
/* We found "filename" */
cp = mhbasename(filename);
if (*cp && *cp!='.' && *cp!='|' && *cp!='!' &&