From 6b30852ded5074652f4304a303521932235c62db Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 19 Sep 2007 01:52:59 -0700 Subject: [PATCH] builtin-for-each-ref.c::copy_name() - do not overstep the buffer. This was introduced during xmemdupz() conversion. Signed-off-by: Junio C Hamano --- builtin-for-each-ref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index 725c1df0f..e868a4b6d 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -309,7 +309,7 @@ static const char *copy_line(const char *buf) static const char *copy_name(const char *buf) { const char *cp; - for (cp = buf; *cp != '\n'; cp++) { + for (cp = buf; *cp && *cp != '\n'; cp++) { if (!strncmp(cp, " <", 2)) return xmemdupz(buf, cp - buf); } -- 2.26.2