]> granicus.if.org Git - neomutt/commit
Fix next_token() oob read. (closes #3787)
authorKevin McCarthy <kevin@8t8.us>
Sun, 18 Oct 2015 11:45:51 +0000 (19:45 +0800)
committerKevin McCarthy <kevin@8t8.us>
Sun, 18 Oct 2015 11:45:51 +0000 (19:45 +0800)
commit0a76f8fb7ed09b396cfd7fbd320ffea2f647669f
tree8f553203196f572fdfb9ef92e1e7fe894da6ce4b
parent8df7dfd37155a14361efd82f293825a89fb7dda9
Fix next_token() oob read.  (closes #3787)

With specially crafted input to 'mutt -H', the line "Return-Path:<() "
is read and passed to mutt_parse_rfc822_line(). "<() " is then passed
through to rfc822_parse_adrlist().

Eventually, inside next_token(), is_special(*s) is called when s
points to the end of the string ('\0').  This macro calls strchr,
which will actually match and return a pointer to the trailing '\0' in
RFC822Specials!  This causes "s + 1" to be returned, skipping past the
end of string inside parse_mailboxdomain().

This patch adds a check to make sure *s is non-null before calling
is_special(*s).
rfc822.c