summaryrefslogtreecommitdiff
path: root/builtin/mailinfo.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-10-14 22:34:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-10-19 05:13:27 (GMT)
commitb6af8ed13a73a705b79e79ecd7320f3e90e98315 (patch)
treee841bbd0295024949d6d5edbb8164fffb325639f /builtin/mailinfo.c
parent3a8fcdaf844910578d91ff225bcb1587ddb4d062 (diff)
downloadgit-b6af8ed13a73a705b79e79ecd7320f3e90e98315.zip
git-b6af8ed13a73a705b79e79ecd7320f3e90e98315.tar.gz
git-b6af8ed13a73a705b79e79ecd7320f3e90e98315.tar.bz2
mailinfo: fix an off-by-one error in the boundary stack
We pre-increment the pointer that we will use to store something at, so the pointer is already beyond the end of the array if it points at content[MAX_BOUNDARIES]. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/mailinfo.c')
-rw-r--r--builtin/mailinfo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index addc0e0..1566c19 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -185,7 +185,7 @@ static void handle_content_type(struct strbuf *line)
if (slurp_attr(line->buf, "boundary=", boundary)) {
strbuf_insert(boundary, 0, "--", 2);
- if (++content_top > &content[MAX_BOUNDARIES]) {
+ if (++content_top >= &content[MAX_BOUNDARIES]) {
fprintf(stderr, "Too many boundaries to handle\n");
exit(1);
}