Check for EOF while parsing mails

Reported via Coverity.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2017-04-17 22:51:58 +02:00
parent 152312932e
commit 917eead1fb
2 changed files with 2 additions and 2 deletions

View File

@@ -232,7 +232,7 @@ static int split_mbox(const char *file, const char *dir, int allow_bare,
do {
peek = fgetc(f);
} while (isspace(peek));
} while (peek >= 0 && isspace(peek));
ungetc(peek, f);
if (strbuf_getwholeline(&buf, f, '\n')) {

View File

@@ -1094,7 +1094,7 @@ int mailinfo(struct mailinfo *mi, const char *msg, const char *patch)
do {
peek = fgetc(mi->input);
} while (isspace(peek));
} while (peek >= 0 && isspace(peek));
ungetc(peek, mi->input);
/* process the email header */