mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-09 03:10:27 +00:00
fix bug parsing repeatable http headers
This commit is contained in:
parent
f202fc2c17
commit
bec66151a6
1 changed files with 6 additions and 2 deletions
|
@ -236,8 +236,12 @@ int ParseHttpMessage(struct HttpMessage *r, const char *p, size_t n) {
|
||||||
unsigned c2;
|
unsigned c2;
|
||||||
struct HttpHeader *p1, *p2;
|
struct HttpHeader *p1, *p2;
|
||||||
p1 = r->xheaders.p;
|
p1 = r->xheaders.p;
|
||||||
c2 = r->xheaders.c + 2;
|
c2 = r->xheaders.c;
|
||||||
c2 = c2 >> 1;
|
if (c2 == 0) {
|
||||||
|
c2 = 1;
|
||||||
|
} else {
|
||||||
|
c2 = c2 * 2;
|
||||||
|
}
|
||||||
if ((p2 = realloc(p1, c2 * sizeof(*p1)))) {
|
if ((p2 = realloc(p1, c2 * sizeof(*p1)))) {
|
||||||
r->xheaders.p = p2;
|
r->xheaders.p = p2;
|
||||||
r->xheaders.c = c2;
|
r->xheaders.c = c2;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue