Skip to content

Commit b6af8ed

Browse files
committed
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 <[email protected]>
1 parent 3a8fcda commit b6af8ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/mailinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static void handle_content_type(struct strbuf *line)
185185

186186
if (slurp_attr(line->buf, "boundary=", boundary)) {
187187
strbuf_insert(boundary, 0, "--", 2);
188-
if (++content_top > &content[MAX_BOUNDARIES]) {
188+
if (++content_top >= &content[MAX_BOUNDARIES]) {
189189
fprintf(stderr, "Too many boundaries to handle\n");
190190
exit(1);
191191
}

0 commit comments

Comments
 (0)