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>
This commit is contained in:
parent
3a8fcdaf84
commit
b6af8ed13a
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user