fix potential overflow
This commit is contained in:
parent
d2433a452c
commit
4b954c0874
|
@ -184,6 +184,7 @@ typedef enum ELogicConditionType {
|
||||||
#define TSDB_UNI_LEN 24
|
#define TSDB_UNI_LEN 24
|
||||||
#define TSDB_USER_LEN TSDB_UNI_LEN
|
#define TSDB_USER_LEN TSDB_UNI_LEN
|
||||||
|
|
||||||
|
#define TSDB_POINTER_PRINT_BYTES 18 // 0x1122334455667788
|
||||||
// ACCOUNT is a 32 bit positive integer
|
// ACCOUNT is a 32 bit positive integer
|
||||||
// this is the length of its string representation, including the terminator zero
|
// this is the length of its string representation, including the terminator zero
|
||||||
#define TSDB_ACCT_ID_LEN 11
|
#define TSDB_ACCT_ID_LEN 11
|
||||||
|
|
|
@ -391,7 +391,7 @@ static int32_t createPartialFunction(const SFunctionNode* pSrcFunc, SFunctionNod
|
||||||
nodesDestroyList(pParameterList);
|
nodesDestroyList(pParameterList);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
char name[TSDB_FUNC_NAME_LEN + TSDB_NAME_DELIMITER_LEN + sizeof(pSrcFunc) + 1] = {0};
|
char name[TSDB_FUNC_NAME_LEN + TSDB_NAME_DELIMITER_LEN + TSDB_POINTER_PRINT_BYTES + 1] = {0};
|
||||||
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%p", (*pPartialFunc)->functionName, pSrcFunc);
|
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%p", (*pPartialFunc)->functionName, pSrcFunc);
|
||||||
taosCreateMD5Hash(name, len);
|
taosCreateMD5Hash(name, len);
|
||||||
strncpy((*pPartialFunc)->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
|
strncpy((*pPartialFunc)->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
|
||||||
|
|
|
@ -1615,7 +1615,7 @@ static void partTagsSetAlias(char* pAlias, const char* pTableAlias, const char*
|
||||||
int32_t len = snprintf(name, TSDB_COL_FNAME_LEN, "%s.%s", pTableAlias, pColName);
|
int32_t len = snprintf(name, TSDB_COL_FNAME_LEN, "%s.%s", pTableAlias, pColName);
|
||||||
|
|
||||||
taosCreateMD5Hash(name, len);
|
taosCreateMD5Hash(name, len);
|
||||||
strcpy(pAlias, name);
|
strncpy(pAlias, name, TSDB_COL_NAME_LEN - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SNode* partTagsCreateWrapperFunc(const char* pFuncName, SNode* pNode) {
|
static SNode* partTagsCreateWrapperFunc(const char* pFuncName, SNode* pNode) {
|
||||||
|
@ -2136,7 +2136,7 @@ static SNode* rewriteUniqueOptCreateFirstFunc(SFunctionNode* pSelectValue, SNode
|
||||||
strcpy(pFunc->node.aliasName, pSelectValue->node.aliasName);
|
strcpy(pFunc->node.aliasName, pSelectValue->node.aliasName);
|
||||||
} else {
|
} else {
|
||||||
int64_t pointer = (int64_t)pFunc;
|
int64_t pointer = (int64_t)pFunc;
|
||||||
char name[TSDB_FUNC_NAME_LEN + sizeof(pointer) + TSDB_NAME_DELIMITER_LEN + 1] = {0};
|
char name[TSDB_FUNC_NAME_LEN + TSDB_POINTER_PRINT_BYTES + TSDB_NAME_DELIMITER_LEN + 1] = {0};
|
||||||
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%" PRId64 "", pFunc->functionName, pointer);
|
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%" PRId64 "", pFunc->functionName, pointer);
|
||||||
taosCreateMD5Hash(name, len);
|
taosCreateMD5Hash(name, len);
|
||||||
strncpy(pFunc->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
|
strncpy(pFunc->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
|
||||||
|
|
|
@ -388,7 +388,7 @@ static int32_t stbSplAppendWStart(SNodeList* pFuncs, int32_t* pIndex) {
|
||||||
}
|
}
|
||||||
strcpy(pWStart->functionName, "_wstart");
|
strcpy(pWStart->functionName, "_wstart");
|
||||||
int64_t pointer = (int64_t)pWStart;
|
int64_t pointer = (int64_t)pWStart;
|
||||||
char name[TSDB_COL_NAME_LEN + sizeof(pointer) + TSDB_NAME_DELIMITER_LEN + 1] = {0};
|
char name[TSDB_COL_NAME_LEN + TSDB_POINTER_PRINT_BYTES + TSDB_NAME_DELIMITER_LEN + 1] = {0};
|
||||||
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%" PRId64 "", pWStart->functionName, pointer);
|
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%" PRId64 "", pWStart->functionName, pointer);
|
||||||
taosCreateMD5Hash(name, len);
|
taosCreateMD5Hash(name, len);
|
||||||
strncpy(pWStart->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
|
strncpy(pWStart->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
|
||||||
|
@ -418,7 +418,7 @@ static int32_t stbSplAppendWEnd(SWindowLogicNode* pWin, int32_t* pIndex) {
|
||||||
}
|
}
|
||||||
strcpy(pWEnd->functionName, "_wend");
|
strcpy(pWEnd->functionName, "_wend");
|
||||||
int64_t pointer = (int64_t)pWEnd;
|
int64_t pointer = (int64_t)pWEnd;
|
||||||
char name[TSDB_COL_NAME_LEN + sizeof(pointer) + TSDB_NAME_DELIMITER_LEN + 1] = {0};
|
char name[TSDB_COL_NAME_LEN + TSDB_POINTER_PRINT_BYTES + TSDB_NAME_DELIMITER_LEN + 1] = {0};
|
||||||
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%" PRId64 "", pWEnd->functionName, pointer);
|
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%" PRId64 "", pWEnd->functionName, pointer);
|
||||||
taosCreateMD5Hash(name, len);
|
taosCreateMD5Hash(name, len);
|
||||||
strncpy(pWEnd->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
|
strncpy(pWEnd->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
|
||||||
|
|
Loading…
Reference in New Issue