feat:[TD-32642] fix encode error
This commit is contained in:
parent
0165684131
commit
0c25fccb8d
|
@ -413,9 +413,7 @@ static FORCE_INLINE int32_t tDecodeBinary(SDecoder* pCoder, uint8_t** val, uint3
|
|||
|
||||
static FORCE_INLINE int32_t tDecodeCStrAndLen(SDecoder* pCoder, char** val, uint32_t* len) {
|
||||
TAOS_CHECK_RETURN(tDecodeBinary(pCoder, (uint8_t**)val, len));
|
||||
if (*len > 0) {
|
||||
(*len) -= 1;
|
||||
}
|
||||
(*len) -= 1; // *len = 0 - 1
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -429,7 +427,7 @@ static int32_t tDecodeCStrTo(SDecoder* pCoder, char* val) {
|
|||
uint32_t len;
|
||||
TAOS_CHECK_RETURN(tDecodeCStrAndLen(pCoder, &pStr, &len));
|
||||
|
||||
if (pCoder->pos + 1 < pCoder->size) {
|
||||
if (len < pCoder->size) {
|
||||
TAOS_MEMCPY(val, pStr, len + 1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue