Merge pull request #17418 from taosdata/fix/invalidPack

fix: fix invalid packet
This commit is contained in:
Shengliang Guan 2022-10-17 22:58:04 +08:00 committed by GitHub
commit b660f03f24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
SConnBuffer* p = connBuf;
if (p->left != 0) {
if (p->left != 0 || p->total <= 0) {
return -1;
}
int total = connBuf->total;
int total = p->total;
if (total >= HEADSIZE && !p->invalid) {
*buf = taosMemoryCalloc(1, total);
memcpy(*buf, p->buf, total);