You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where the function kws_read_frame() read a ping frame which the frame length is 6(2 header and 4 payload) and followed with a text frame. Then the code below will make the kws->datalen to be 9:
if ((kws->datalen = kws_string_read(kws, kws->buffer, 9 + 1, kws->block)) < 0)
This will trigger the error in below code because the need will be -3:
need = (kws->plen - (kws->datalen - need));
if (need < 0) {
/* invalid read - protocol err .. */
ks_log(KS_LOG_ERROR, "Read frame error because need = %ld\n", need);
*oc = WSOC_CLOSE;
return kws_close(kws, WS_NONE);
}
I have modify the code to:
if ((kws->datalen = kws_string_read(kws, kws->buffer, 6 + 1, kws->block)) < 0)
and it seems worked. But if the ping frame length is less than 6, the error is still exist. What about a perfect solution?
The text was updated successfully, but these errors were encountered:
Where the function kws_read_frame() read a ping frame which the frame length is 6(2 header and 4 payload) and followed with a text frame. Then the code below will make the kws->datalen to be 9:
if ((kws->datalen = kws_string_read(kws, kws->buffer, 9 + 1, kws->block)) < 0)
This will trigger the error in below code because the need will be -3:
need = (kws->plen - (kws->datalen - need));
if (need < 0) {
/* invalid read - protocol err .. */
ks_log(KS_LOG_ERROR, "Read frame error because need = %ld\n", need);
*oc = WSOC_CLOSE;
return kws_close(kws, WS_NONE);
}
I have modify the code to:
if ((kws->datalen = kws_string_read(kws, kws->buffer, 6 + 1, kws->block)) < 0)
and it seems worked. But if the ping frame length is less than 6, the error is still exist. What about a perfect solution?
The text was updated successfully, but these errors were encountered: