mailinfo & mailsplit: check for EOF while parsing
commitf0733c13ed8b79bb10e240c4b4a6630784c7d258
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 4 May 2017 13:56:14 +0000 (4 15:56 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 May 2017 03:18:19 +0000 (8 12:18 +0900)
tree2f388aa60e8c672f32dc8926163f2d7ccaa51530
parente7b65e205af88755567c3283ee29ca9fb9af11a9
mailinfo & mailsplit: check for EOF while parsing

While POSIX states that it is okay to pass EOF to isspace() (and it seems
to be implied that EOF should *not* be treated as whitespace), and also to
pass EOF to ungetc() (which seems to be intended to fail without buffering
the character), it is much better to handle these cases explicitly. Not
only does it reduce head-scratching (and helps static analysis avoid
reporting false positives), it also lets us handle files containing
nothing but whitespace by erroring out.

Reported via Coverity.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mailsplit.c
mailinfo.c