未验证 提交 b607f473 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #17996 from taosdata/fix/TD-20277

fix: fix valgrind invalid read error
......@@ -1028,11 +1028,11 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
int32_t type = GET_PARAM_TYPE(pInput);
bool tzPresent = (inputNum == 2) ? true : false;
char *tz;
int32_t tzLen;
char tz[20] = {0};
int32_t tzLen = 0;
if (tzPresent) {
tz = varDataVal(pInput[1].columnData->pData);
tzLen = varDataLen(pInput[1].columnData->pData);
memcpy(tz, varDataVal(pInput[1].columnData->pData), tzLen);
}
for (int32_t i = 0; i < pInput[0].numOfRows; ++i) {
......@@ -1071,8 +1071,10 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
int32_t len = (int32_t)strlen(buf);
// add timezone string
snprintf(buf + len, tzLen + 1, "%s", tz);
len += tzLen;
if (tzLen > 0) {
snprintf(buf + len, tzLen + 1, "%s", tz);
len += tzLen;
}
if (hasFraction) {
int32_t fracLen = (int32_t)strlen(fraction) + 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册