From: Junio C Hamano Date: Thu, 4 May 2006 04:03:25 +0000 (-0700) Subject: builtin-grep: terminate correctly at EOF X-Git-Tag: v1.4.0-rc1~142^2~11 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7ed36f56e33bd838d06521a37a916516397e9e8b;p=git.git builtin-grep: terminate correctly at EOF It barfed and segfaulted with an incomplete line. Signed-off-by: Junio C Hamano --- diff --git a/builtin-grep.c b/builtin-grep.c index 2124fa62e..e87b5cb48 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -264,6 +264,8 @@ static int grep_buffer(struct grep_opt *opt, const char *name, } *eol = ch; bol = eol + 1; + if (!left) + break; left--; lno++; }