kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 6dbcb30eb95925b124129c35cdd2200701a6e88e
parent 89f12a61e545375b0d825e8f466aa4d24619021e
Author: Joris Vink <joris@coders.se>
Date:   Tue,  6 Aug 2013 15:58:21 +0200

properly calculate if we need to expand the header block in spdy_header_block_add().

Diffstat:
src/spdy.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/spdy.c b/src/spdy.c @@ -218,13 +218,15 @@ void spdy_header_block_add(struct spdy_header_block *hblock, char *name, char *value) { u_int8_t *p; - u_int32_t nlen, vlen; + u_int32_t nlen, vlen, tlen; kore_debug("spdy_header_block_add(%p, %s, %s)", hblock, name, value); nlen = strlen(name); vlen = strlen(value); - if ((nlen + vlen + hblock->header_offset) > hblock->header_block_len) { + + tlen = nlen + 4 + vlen + 4; + if ((tlen + hblock->header_offset) > hblock->header_block_len) { hblock->header_block_len += nlen + vlen + 128; hblock->header_block = kore_realloc(hblock->header_block, hblock->header_block_len);