X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=blobdiff_plain;f=src%2Fsrc%2Freceive.c;h=a0467e8c8990e0480e3e9c865e085f93b940aea7;hp=6d54ad33cfe630fd4f7000eb00640c63e5d888c7;hb=56ac062a3ff94fc4e1bbfc2293119c079a4e980b;hpb=fcb900d84cc71cb169bd1b223920de1026772695 diff --git a/src/src/receive.c b/src/src/receive.c index 6d54ad3..a0467e8 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -1827,8 +1827,11 @@ for (;;) if (ptr >= header_size - 4) { int oldsize = header_size; - /* header_size += 256; */ + + if (header_size >= INT_MAX/2) + goto OVERSIZE; header_size *= 2; + if (!store_extend(next->text, oldsize, header_size)) next->text = store_newblock(next->text, header_size, ptr); } @@ -1934,6 +1937,7 @@ for (;;) if (message_size >= header_maxsize) { +OVERSIZE: next->text[ptr] = 0; next->slen = ptr; next->type = htype_other; @@ -2005,7 +2009,8 @@ for (;;) if (nextch == ' ' || nextch == '\t') { next->text[ptr++] = nextch; - message_size++; + if (++message_size >= header_maxsize) + goto OVERSIZE; continue; /* Iterate the loop */ } else if (nextch != EOF) (receive_ungetc)(nextch); /* For next time */