diff options
author | Junio C Hamano <junkio@cox.net> | 2006-05-03 21:03:25 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-05-03 21:03:25 -0700 |
commit | 7ed36f56e33bd838d06521a37a916516397e9e8b (patch) | |
tree | 6f672da4064f192e2dff91180f1f24fabb591b58 /builtin-grep.c | |
parent | 1e3d90e0135274ad89cd8ee0722e2dd043ec0052 (diff) | |
download | git-7ed36f56e33bd838d06521a37a916516397e9e8b.tar.gz git-7ed36f56e33bd838d06521a37a916516397e9e8b.tar.xz |
builtin-grep: terminate correctly at EOF
It barfed and segfaulted with an incomplete line.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-grep.c')
-rw-r--r-- | builtin-grep.c | 2 |
1 files changed, 2 insertions, 0 deletions
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++; } |