Re: [PATCH 10/26] Check for EOF while parsing mails

2 messages, 2 authors, 2017-04-28 · open the first message on its own page

Re: [PATCH 10/26] Check for EOF while parsing mails

From: Junio C Hamano <hidden>
Date: 2017-04-27 06:07:47

Johannes Schindelin [off-list ref] writes:
Reported via Coverity.

Signed-off-by: Johannes Schindelin <redacted>
---
 builtin/mailsplit.c | 2 +-
 mailinfo.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Good find.  I'd retitle with a prefix

	mailinfo & mailsplit: check for EOF while parsing

so that it is clear that this patch is about lower level machinery
(as oppose to something like "git am").

Thanks.
quoted hunk
diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c
index 30681681c13..c0d88f97512 100644
--- a/builtin/mailsplit.c
+++ b/builtin/mailsplit.c
@@ -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')) {
diff --git a/mailinfo.c b/mailinfo.c
index 68037758f2f..60dcad7b714 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -1099,7 +1099,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 */

Re: [PATCH 10/26] Check for EOF while parsing mails

From: Johannes Schindelin <hidden>
Date: 2017-04-28 09:55:38

Hi Junio,

On Wed, 26 Apr 2017, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
Reported via Coverity.

Signed-off-by: Johannes Schindelin <redacted>
---
 builtin/mailsplit.c | 2 +-
 mailinfo.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Good find.  I'd retitle with a prefix

	mailinfo & mailsplit: check for EOF while parsing

so that it is clear that this patch is about lower level machinery
(as oppose to something like "git am").
True. Will be fixed in the next iteration,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help