]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix incorrect string termination
authorSeven Du <dujinfang@gmail.com>
Sun, 7 Sep 2014 03:45:12 +0000 (11:45 +0800)
committerSeven Du <dujinfang@gmail.com>
Sun, 7 Sep 2014 03:45:12 +0000 (11:45 +0800)
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

index 70c91fb59cb8fbb00e1fa4b1d0fac1b9ad900348..6e91ff6493756ed091bd022cb99c33d15fe2c9c3 100644 (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;