@matheusbsbs / matheus-bagliano / commits / 6b30852ded
Fork 0

builtin-for-each-ref.c::copy_name() - do not overstep the buffer.

This was introduced during xmemdupz() conversion. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Sep 19, 2007 at 01:52 UTC 6b30852ded5074652f4304a303521932235c62db
1 file changed +1 -1
builtin-for-each-ref.c
+1 -1
@@ -309,7 +309,7 @@ static const char *copy_line(const char *buf)
309 static const char *copy_name(const char *buf)
310 {
311 const char *cp;
312 - for (cp = buf; *cp != '\n'; cp++) {
312 + for (cp = buf; *cp && *cp != '\n'; cp++) {
313 if (!strncmp(cp, " <", 2))
314 return xmemdupz(buf, cp - buf);
315 }