[PATCH] git format-patch: avoid underrun when format.headers is empty or all NLs | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
* 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
---
I spotted this via inspection.
builtin-log.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index f4975cf..911fd65 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);
--
1.6.0.4.g750768
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Newbies FAQ] [Kernel List] [Site Home] [Free Online Dating] [Gcc Help] [IETF Annouce] [DCCP] [Netdev] [Networking] [Security] [V4L] [Bugtraq] [Free Online Dating] [Rubini] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Linux SCSI] [DDR & Rambus] [Linux Resources]