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>
This commit is contained in:
parent
ca0328354a
commit
6b30852ded
@ -309,7 +309,7 @@ static const char *copy_line(const char *buf)
|
|||||||
static const char *copy_name(const char *buf)
|
static const char *copy_name(const char *buf)
|
||||||
{
|
{
|
||||||
const char *cp;
|
const char *cp;
|
||||||
for (cp = buf; *cp != '\n'; cp++) {
|
for (cp = buf; *cp && *cp != '\n'; cp++) {
|
||||||
if (!strncmp(cp, " <", 2))
|
if (!strncmp(cp, " <", 2))
|
||||||
return xmemdupz(buf, cp - buf);
|
return xmemdupz(buf, cp - buf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user