From 29cdc8bb55f41774f2af40fbaef6bb3ff308f2ed Mon Sep 17 00:00:00 2001 From: slzhou Date: Tue, 19 Sep 2023 08:27:20 +0800 Subject: [PATCH] fix: fix address sanitizer error --- source/common/src/tmsg.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 04c86938de..c1e8d9a559 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -35,9 +35,7 @@ if(tDecodeIsEnd(&decoder)){ \ if(tDecodeI32(&decoder, &pReq->sqlLen) < 0) return -1; \ if(pReq->sqlLen > 0){ \ - pReq->sql = taosMemoryCalloc(1, pReq->sqlLen + 1); \ - if (pReq->sql == NULL) return -1; \ - if (tDecodeCStrTo(&decoder, pReq->sql) < 0) return -1; \ + if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->sql, NULL) < 0) return -1; \ } \ } \ } while (0) @@ -46,7 +44,7 @@ do { \ if (tEncodeI32(&encoder, pReq->sqlLen) < 0) return -1; \ if (pReq->sqlLen > 0){ \ - if (tEncodeCStr(&encoder, pReq->sql) < 0) return -1; \ + if (tEncodeBinary(&encoder, pReq->sql, pReq->sqlLen) < 0) return -1; \ } \ } while (0)