Skip to content

Commit

Permalink
builtin-for-each-ref.c::copy_name() - do not overstep the buffer.
Browse files Browse the repository at this point in the history
This was introduced during xmemdupz() conversion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Sep 19, 2007
1 parent ca03283 commit 6b30852
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-for-each-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6b30852

Please sign in to comment.