mirror of
https://github.com/payden/libwsclient
synced 2024-10-27 17:54:01 +00:00
Bugfixes
Modifying payload_len_small in libwsclient_send by OR'ing with 0x80 Just set the frame byte appropriately without modifying payload_len_small Also move setting payload_sz back to WS_HELPER_RECV_BUF size *before* memsetting.. overflowing my bounds there. Woops.
This commit is contained in:
parent
1ac960127e
commit
89bc677a40
@ -404,8 +404,9 @@ void *libwsclient_helper_socket_thread(void *ptr) {
|
|||||||
}
|
}
|
||||||
payload_idx = 0;
|
payload_idx = 0;
|
||||||
payload = (char *)malloc(HELPER_RECV_BUF_SIZE);
|
payload = (char *)malloc(HELPER_RECV_BUF_SIZE);
|
||||||
memset(payload, 0, payload_sz);
|
|
||||||
payload_sz = HELPER_RECV_BUF_SIZE;
|
payload_sz = HELPER_RECV_BUF_SIZE;
|
||||||
|
memset(payload, 0, payload_sz);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
memset(recv_buf, 0, HELPER_RECV_BUF_SIZE);
|
memset(recv_buf, 0, HELPER_RECV_BUF_SIZE);
|
||||||
n = recv(remote_sock, recv_buf, HELPER_RECV_BUF_SIZE - 1, 0);
|
n = recv(remote_sock, recv_buf, HELPER_RECV_BUF_SIZE - 1, 0);
|
||||||
@ -846,9 +847,8 @@ int libwsclient_send(wsclient *client, char *strdata) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(data, 0, frame_size);
|
memset(data, 0, frame_size);
|
||||||
payload_len_small |= 0x80;
|
*data = finNopcode;
|
||||||
memcpy(data, &finNopcode, 1);
|
*(data+1) = payload_len_small | 0x80; //payload length with mask bit on
|
||||||
memcpy(data+1, &payload_len_small, 1); //mask bit on, 7 bit payload len
|
|
||||||
if(payload_len_small == 126) {
|
if(payload_len_small == 126) {
|
||||||
payload_len &= 0xffff;
|
payload_len &= 0xffff;
|
||||||
len_size = 2;
|
len_size = 2;
|
||||||
|
@ -119,7 +119,7 @@ char *errors[] = {
|
|||||||
"Unknown error occured",
|
"Unknown error occured",
|
||||||
"Error while getting address info",
|
"Error while getting address info",
|
||||||
"Could connect to any address returned by getaddrinfo",
|
"Could connect to any address returned by getaddrinfo",
|
||||||
"Error sending data in client run thread",
|
"Error receiving data in client run thread",
|
||||||
"Error during libwsclient_close",
|
"Error during libwsclient_close",
|
||||||
"Error sending while handling control frame",
|
"Error sending while handling control frame",
|
||||||
"Received masked frame from server",
|
"Received masked frame from server",
|
||||||
|
Loading…
Reference in New Issue
Block a user