Fix off-by-one
This commit is contained in:
parent
5dac8de322
commit
293eb4489d
1 changed files with 2 additions and 2 deletions
4
quark.c
4
quark.c
|
@ -444,8 +444,8 @@ request(void) {
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
|
|
||||||
/* read request into reqbuf (MAXBUFLEN byte of reqbuf is emergency 0 terminator */
|
/* read request into reqbuf (MAXBUFLEN byte of reqbuf is emergency 0 terminator) */
|
||||||
for (; (r = read(req.fd, reqbuf + offset, MAXBUFLEN - offset)) > 0 && offset < MAXBUFLEN
|
for (; (r = read(req.fd, reqbuf + offset, MAXBUFLEN - offset - 1)) > 0 && offset < MAXBUFLEN
|
||||||
&& !strstr(reqbuf, "\r\n\r\n") && !strstr(reqbuf, "\n\n"); )
|
&& !strstr(reqbuf, "\r\n\r\n") && !strstr(reqbuf, "\n\n"); )
|
||||||
{
|
{
|
||||||
offset += r;
|
offset += r;
|
||||||
|
|
Loading…
Reference in a new issue