always null-terminate reqbuf buffer

thanks Hiltjo for the patch
This commit is contained in:
FRIGN 2014-08-25 00:33:00 +02:00
parent 29c8cfa201
commit 73d8b456eb

View file

@ -451,8 +451,9 @@ request(void) {
&& !strstr(reqbuf, "\r\n\r\n") && !strstr(reqbuf, "\n\n"); ) && !strstr(reqbuf, "\r\n\r\n") && !strstr(reqbuf, "\n\n"); )
{ {
offset += r; offset += r;
reqbuf[offset] = 0;
} }
reqbuf[offset] = 0;
if (r == -1) { if (r == -1) {
logerrmsg("error\tread: %s\n", strerror(errno)); logerrmsg("error\tread: %s\n", strerror(errno));
return -1; return -1;