chiark / gitweb /
lib/cgi.c (cgi__input): Write terminating null within allocated buffer.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 15 Dec 2015 19:15:23 +0000 (19:15 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 15 Jan 2016 20:37:46 +0000 (20:37 +0000)
commit751b34ac0cc1a39e8232aeaaa3c04295b0ec503f
treebf2200fa942c8121aa2dde20e9003fccb59db062
parent224cac449a246bd7432fd5fb4e15f942547185d3
lib/cgi.c (cgi__input): Write terminating null within allocated buffer.

This one's been there forever.  It sometimes results in `malloc'
reporting a (rather impressive) assertion failure

disorder: malloc.c:3096: sYSMALLOc: Assertion `(old_top ==
(((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) -
__builtin_offsetof (struct malloc_chunk, fd)))) &&
old_size == 0) || ((unsigned long) (old_size) >=
(unsigned long)((((__builtin_offsetof (struct malloc_chunk,
fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 *
(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) &&
((unsigned long)old_end & pagemask) == 0)' failed.

often after producing the beginning of the output page, so the end user
gets a blank window.  Not really what we want.

This fix closes issue #57.
lib/cgi.c