fix invalid packet

This commit is contained in:
yihaoDeng 2022-10-17 19:56:59 +08:00
parent 50dfc57cda
commit 5ff8bb5bc0
1 changed files with 2 additions and 2 deletions

View File

@ -128,10 +128,10 @@ int transDumpFromBuffer(SConnBuffer* connBuf, char** buf) {
static const int HEADSIZE = sizeof(STransMsgHead); static const int HEADSIZE = sizeof(STransMsgHead);
SConnBuffer* p = connBuf; SConnBuffer* p = connBuf;
if (p->left != 0) { if (p->left != 0 || p->total <= 0) {
return -1; return -1;
} }
int total = connBuf->total; int total = p->total;
if (total >= HEADSIZE && !p->invalid) { if (total >= HEADSIZE && !p->invalid) {
*buf = taosMemoryCalloc(1, total); *buf = taosMemoryCalloc(1, total);
memcpy(*buf, p->buf, total); memcpy(*buf, p->buf, total);