summaryrefslogtreecommitdiff
path: root/builtin-for-each-ref.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-09-19 08:52:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-19 08:54:24 (GMT)
commit6b30852ded5074652f4304a303521932235c62db (patch)
treee56406bbb3e6e4a653d06eb198d75f7a7b6c809a /builtin-for-each-ref.c
parentca0328354afbf4ec6941cb4312bfc6908ab06d73 (diff)
downloadgit-6b30852ded5074652f4304a303521932235c62db.zip
git-6b30852ded5074652f4304a303521932235c62db.tar.gz
git-6b30852ded5074652f4304a303521932235c62db.tar.bz2
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>
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 725c1df..e868a4b 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);
}