mirror of
https://github.com/lxsang/antd-tunnel-plugin
synced 2025-04-05 08:06:44 +02:00
fix bug
This commit is contained in:
parent
4cdfaf5da2
commit
602d121403
BIN
dist/tunnel-0.1.0b.tar.gz
vendored
BIN
dist/tunnel-0.1.0b.tar.gz
vendored
Binary file not shown.
7
tunnel.c
7
tunnel.c
@ -981,6 +981,7 @@ void *handle(void *rq_data)
|
|||||||
{
|
{
|
||||||
// we have data, now read the message,
|
// we have data, now read the message,
|
||||||
// the message must be in bin
|
// the message must be in bin
|
||||||
|
int ws_msg_len = h->plen;
|
||||||
buffer = (uint8_t *)malloc(h->plen + 1);
|
buffer = (uint8_t *)malloc(h->plen + 1);
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
@ -1018,10 +1019,14 @@ void *handle(void *rq_data)
|
|||||||
// data size
|
// data size
|
||||||
(void)memcpy(&msg.header.size, buffer + offset, sizeof(msg.header.size));
|
(void)memcpy(&msg.header.size, buffer + offset, sizeof(msg.header.size));
|
||||||
offset += sizeof(msg.header.size);
|
offset += sizeof(msg.header.size);
|
||||||
|
|
||||||
// data
|
// data
|
||||||
msg.data = buffer + offset;
|
msg.data = buffer + offset;
|
||||||
offset += msg.header.size;
|
offset += msg.header.size;
|
||||||
|
if(offset > (int)ws_msg_len)
|
||||||
|
{
|
||||||
|
ERROR("Invalid message len: %d", msg.header.size);
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
// verify end magic
|
// verify end magic
|
||||||
(void)memcpy(&u16, buffer + offset, sizeof(u16));
|
(void)memcpy(&u16, buffer + offset, sizeof(u16));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user