diff --git a/src/query/src/qFilter.c b/src/query/src/qFilter.c index c15a8c779d88664add8f4825eb3cf14665ebc7fa..fdd9ef59cb13a6f6c1ce403d0e64e1774caa2297 100644 --- a/src/query/src/qFilter.c +++ b/src/query/src/qFilter.c @@ -1164,9 +1164,9 @@ int32_t filterAddGroupUnitFromNode(SFilterInfo *info, tExprNode* tree, SArray *g if(pLeft->_node.pRight->pVal->nLen >= TSDB_MAX_JSON_KEY_LEN) return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; char keyMd5[TSDB_MAX_JSON_KEY_MD5_LEN] = {0}; jsonKeyMd5(pLeft->_node.pRight->pVal->pz, pLeft->_node.pRight->pVal->nLen, keyMd5); - strncpy(schema->name, keyMd5, TSDB_MAX_JSON_KEY_MD5_LEN); + memcpy(schema->name, keyMd5, TSDB_MAX_JSON_KEY_MD5_LEN); - void* data = getJsonTagValue(info->pTable, schema->name, strlen(schema->name), &schema->colId); + void* data = getJsonTagValue(info->pTable, schema->name, TSDB_MAX_JSON_KEY_MD5_LEN, &schema->colId); if(data == NULL) return TSDB_CODE_QRY_JSON_KEY_NOT_EXIST; schema->type = *(char*)data; // if exist json tag-> operation get type so that can set data if (tree->_node.optr == TSDB_RELATION_IN_IN) the next and set value in filterInitValFieldData assert(schema->type > TSDB_DATA_TYPE_NULL && schema->type < TSDB_DATA_TYPE_JSON); @@ -1180,7 +1180,7 @@ int32_t filterAddGroupUnitFromNode(SFilterInfo *info, tExprNode* tree, SArray *g if(tree->_node.pRight->pVal->nLen >= TSDB_MAX_JSON_KEY_LEN) return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; char keyMd5[TSDB_MAX_JSON_KEY_MD5_LEN] = {0}; jsonKeyMd5(tree->_node.pRight->pVal->pz, tree->_node.pRight->pVal->nLen, keyMd5); - strncpy(schema->name, keyMd5, TSDB_MAX_JSON_KEY_MD5_LEN); + memcpy(schema->name, keyMd5, TSDB_MAX_JSON_KEY_MD5_LEN); } SFilterFieldId left = {0}, right = {0}; diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 60f81292c5d418d6c8694733343721b4e47650f8..2450d85671c1220d2024e580ea034624a43e40e2 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -4081,7 +4081,7 @@ static FORCE_INLINE int32_t tsdbGetJsonTagDataFromId(void *param, int32_t id, ch if (id == TSDB_TBNAME_COLUMN_INDEX) { *data = TABLE_NAME(pTable); } else { - void* jsonData = getJsonTagValue(pTable, name, strlen(name), NULL); + void* jsonData = getJsonTagValue(pTable, name, TSDB_MAX_JSON_KEY_MD5_LEN, NULL); if (jsonData != NULL) jsonData += CHAR_BYTES; // jump type *data = jsonData; }