1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-02 08:57:19 -04:00

mailcap: prevent segfault on test entry with %s

When a mailcap entry with a testcommand containing %s is encountered, it is ignored. The
entry was freed, but not set to NULL, leading to a segfault later on.
This commit is contained in:
Arjen Stolk 2016-12-28 11:05:50 +01:00 committed by Witold Filipczyk
parent 6d78cf1c23
commit e957e60d5c

View File

@ -301,6 +301,7 @@ parse_optional_fields(struct mailcap_entry *entry, unsigned char *line)
for (field = entry->testcommand; *field; field++) for (field = entry->testcommand; *field; field++)
if (*field == '%' && *(field+1) == 's') { if (*field == '%' && *(field+1) == 's') {
mem_free(entry->testcommand); mem_free(entry->testcommand);
entry->testcommand = NULL;
return 0; return 0;
} }