Skip to content

Commit 6b30852

Browse files
committed
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>
1 parent ca03283 commit 6b30852

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin-for-each-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ static const char *copy_line(const char *buf)
309309
static const char *copy_name(const char *buf)
310310
{
311311
const char *cp;
312-
for (cp = buf; *cp != '\n'; cp++) {
312+
for (cp = buf; *cp && *cp != '\n'; cp++) {
313313
if (!strncmp(cp, " <", 2))
314314
return xmemdupz(buf, cp - buf);
315315
}

0 commit comments

Comments
 (0)