fix incorrect string termination

if read multi times when waiting for a slow client, then bytes is much shorter than datalen
so it could incorrectly terminate the string and data could be lost
This commit is contained in:
Seven Du 2014-09-07 11:45:12 +08:00
parent 59cd3c77d8
commit 4e07845f2d
1 changed files with 1 additions and 1 deletions

View File

@ -264,7 +264,7 @@ int ws_handshake(wsh_t *wsh)
goto err;
}
*(wsh->buffer+bytes) = '\0';
*(wsh->buffer + wsh->datalen) = '\0';
if (strncasecmp(wsh->buffer, "GET ", 4)) {
goto err;