Browse Source

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>
maint
Junio C Hamano 18 years ago
parent
commit
6b30852ded
  1. 2
      builtin-for-each-ref.c

2
builtin-for-each-ref.c

@ -309,7 +309,7 @@ static const char *copy_line(const char *buf) @@ -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);
}

Loading…
Cancel
Save