提交 4e07845f authored 作者: Seven Du's avatar Seven Du

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
上级 59cd3c77
...@@ -264,7 +264,7 @@ int ws_handshake(wsh_t *wsh) ...@@ -264,7 +264,7 @@ int ws_handshake(wsh_t *wsh)
goto err; goto err;
} }
*(wsh->buffer+bytes) = '\0'; *(wsh->buffer + wsh->datalen) = '\0';
if (strncasecmp(wsh->buffer, "GET ", 4)) { if (strncasecmp(wsh->buffer, "GET ", 4)) {
goto err; goto err;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论