mirror of
https://github.com/lxsang/antd-tunnel-plugin
synced 2024-11-16 09:48:21 +01: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,
|
||||
// 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));
|
||||
|
Loading…
Reference in New Issue
Block a user