From 4e07845f2d57f7e633ae4097f3eae55d363a723f Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 7 Sep 2014 11:45:12 +0800 Subject: [PATCH] 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 --- src/mod/endpoints/mod_verto/ws.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/ws.c b/src/mod/endpoints/mod_verto/ws.c index 70c91fb59c..6e91ff6493 100644 --- a/src/mod/endpoints/mod_verto/ws.c +++ b/src/mod/endpoints/mod_verto/ws.c @@ -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;