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>
Junio C Hamano committed
Oct 14, 2015 at 15:34 UTC
b6af8ed13a73a705b79e79ecd7320f3e90e98315
1 file changed
+1
-1
builtin/mailinfo.c
+1
-1
@@ -185,7 +185,7 @@ static void handle_content_type(struct strbuf *line)
185
186
if (slurp_attr(line->buf, "boundary=", boundary)) {
187
strbuf_insert(boundary, 0, "--", 2);
188
- if (++content_top > &content[MAX_BOUNDARIES]) {
188
+ if (++content_top >= &content[MAX_BOUNDARIES]) {
189
fprintf(stderr, "Too many boundaries to handle\n");
190
exit(1);
191
}