diff options
author | Jim Meyering <meyering@redhat.com> | 2008-08-19 20:42:04 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-20 03:08:00 +0200 |
commit | c8c4450e1949055cb57e32425b125f45f3481742 (patch) | |
tree | 3168fbe0efe3bef657a594ad2dd743bc57f5e6e9 /builtin-log.c | |
parent | t1002-read-tree-m-u-2way.sh: use 'git diff -U0' rather than 'diff -U0' (diff) | |
download | git-c8c4450e1949055cb57e32425b125f45f3481742.tar.xz git-c8c4450e1949055cb57e32425b125f45f3481742.zip |
git format-patch: avoid underrun when format.headers is empty or all NLs
* 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>
Diffstat (limited to 'builtin-log.c')
-rw-r--r-- | builtin-log.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-log.c b/builtin-log.c index f4975cf35f..911fd65990 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -461,7 +461,7 @@ static int extra_cc_alloc; 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); |