From 7ed36f56e33bd838d06521a37a916516397e9e8b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 3 May 2006 21:03:25 -0700 Subject: 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 2124fa6..e87b5cb 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++; } -- cgit v0.10.2-6-g49f6