diff --git a/http_parser.c b/http_parser.c index 7556d92..00e7a76 100644 --- a/http_parser.c +++ b/http_parser.c @@ -327,9 +327,10 @@ size_t http_parser_execute (http_parser *parser, for (p=data, pe=data+len; p != pe; p++) { ch = *p; - if (++nread > HTTP_MAX_HEADER_SIZE && PARSING_HEADER(state)) { + if (PARSING_HEADER(state)) { + ++nread; /* Buffer overflow attack */ - goto error; + if (nread > HTTP_MAX_HEADER_SIZE) goto error; } switch (state) {