builtin-grep: terminate correctly at EOF
It barfed and segfaulted with an incomplete line. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
May 3, 2006 at 21:03 UTC
7ed36f56e33bd838d06521a37a916516397e9e8b
1 file changed
+2
builtin-grep.c
+2
@@ -264,6 +264,8 @@ static int grep_buffer(struct grep_opt *opt, const char *name,
264
}
265
*eol = ch;
266
bol = eol + 1;
267
+ if (!left)
268
+ break;
269
left--;
270
lno++;
271
}