Fix ParseHttpMessage failing to store >2 repeatable headers (#657)

This commit is contained in:
Malcolm Seyd 2022-10-10 20:17:17 -07:00 committed by GitHub
parent e557058ac8
commit 84b9b8ed87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 4 deletions

View file

@ -236,8 +236,12 @@ int ParseHttpMessage(struct HttpMessage *r, const char *p, size_t n) {
unsigned c2;
struct HttpHeader *p1, *p2;
p1 = r->xheaders.p;
c2 = r->xheaders.c + 2;
c2 = c2 >> 1;
c2 = r->xheaders.c;
if (c2 == 0) {
c2 = 1;
} else {
c2 = c2 * 2;
}
if ((p2 = realloc(p1, c2 * sizeof(*p1)))) {
r->xheaders.p = p2;
r->xheaders.c = c2;