From: Junio C Hamano Date: Wed, 19 Sep 2007 08:52:59 +0000 (-0700) Subject: builtin-for-each-ref.c::copy_name() - do not overstep the buffer. X-Git-Tag: v1.5.4-rc0~295^2~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6b30852ded5074652f4304a303521932235c62db;p=git.git builtin-for-each-ref.c::copy_name() - do not overstep the buffer. This was introduced during xmemdupz() conversion. Signed-off-by: Junio C Hamano --- 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); }