summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 26e08a0)
raw | patch | inline | side by side (parent: 26e08a0)
author | Jim Meyering <meyering@redhat.com> | |
Tue, 19 Aug 2008 18:42:04 +0000 (20:42 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 20 Aug 2008 01:08:00 +0000 (18:08 -0700) |
* builtin-log.c (add_header): Avoid a buffer underrun when
format.headers is empty or all newlines. Reproduce with this:
git config format.headers '' && git format-patch -1
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
format.headers is empty or all newlines. Reproduce with this:
git config format.headers '' && git format-patch -1
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-log.c | patch | blob | history |
diff --git a/builtin-log.c b/builtin-log.c
index f4975cf35f7f1555739f7657ee62ed983d18cb84..911fd659906ebe87bf0adcd17519dd97777fb948 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
static void add_header(const char *value)
{
int len = strlen(value);
- while (value[len - 1] == '\n')
+ while (len && value[len - 1] == '\n')
len--;
if (!strncasecmp(value, "to: ", 4)) {
ALLOC_GROW(extra_to, extra_to_nr + 1, extra_to_alloc);