aboutsummaryrefslogtreecommitdiff
path: root/builtin-for-each-ref.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-for-each-ref.c')
-rw-r--r--builtin-for-each-ref.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 725c1df0f..e868a4b6d 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -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);
}