1
0
mirror of https://github.com/lxsang/antd-tunnel-plugin synced 2024-07-01 13:09:46 +02:00
This commit is contained in:
lxsang 2021-01-03 00:25:47 +01:00
parent 4cdfaf5da2
commit 602d121403
2 changed files with 6 additions and 1 deletions

Binary file not shown.

View File

@ -981,6 +981,7 @@ void *handle(void *rq_data)
{
// we have data, now read the message,
// the message must be in bin
int ws_msg_len = h->plen;
buffer = (uint8_t *)malloc(h->plen + 1);
if (buffer)
{
@ -1018,10 +1019,14 @@ void *handle(void *rq_data)
// data size
(void)memcpy(&msg.header.size, buffer + offset, sizeof(msg.header.size));
offset += sizeof(msg.header.size);
// data
msg.data = buffer + offset;
offset += msg.header.size;
if(offset > (int)ws_msg_len)
{
ERROR("Invalid message len: %d", msg.header.size);
return task;
}
// verify end magic
(void)memcpy(&u16, buffer + offset, sizeof(u16));