fix packing build with stringop-overflow
This commit is contained in:
parent
be15e4a0ce
commit
58e1322014
|
@ -612,10 +612,10 @@ static int32_t getIntegerFromAuthStr(const char* pStart, char** pNext) {
|
||||||
return taosStr2Int32(buf, NULL, 10);
|
return taosStr2Int32(buf, NULL, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getStringFromAuthStr(const char* pStart, char* pStr, char** pNext) {
|
static void getStringFromAuthStr(const char* pStart, char* pStr, uint32_t dstLen, char** pNext) {
|
||||||
char* p = strchr(pStart, '*');
|
char* p = strchr(pStart, '*');
|
||||||
if (NULL == p) {
|
if (NULL == p) {
|
||||||
tstrncpy(pStr, pStart, strlen(pStart) + 1);
|
tstrncpy(pStr, pStart, dstLen);
|
||||||
*pNext = NULL;
|
*pNext = NULL;
|
||||||
} else {
|
} else {
|
||||||
strncpy(pStr, pStart, p - pStart);
|
strncpy(pStr, pStart, p - pStart);
|
||||||
|
@ -628,10 +628,10 @@ static void getStringFromAuthStr(const char* pStart, char* pStr, char** pNext) {
|
||||||
|
|
||||||
static void stringToUserAuth(const char* pStr, int32_t len, SUserAuthInfo* pUserAuth) {
|
static void stringToUserAuth(const char* pStr, int32_t len, SUserAuthInfo* pUserAuth) {
|
||||||
char* p = NULL;
|
char* p = NULL;
|
||||||
getStringFromAuthStr(pStr, pUserAuth->user, &p);
|
getStringFromAuthStr(pStr, pUserAuth->user, TSDB_USER_LEN, &p);
|
||||||
pUserAuth->tbName.acctId = getIntegerFromAuthStr(p, &p);
|
pUserAuth->tbName.acctId = getIntegerFromAuthStr(p, &p);
|
||||||
getStringFromAuthStr(p, pUserAuth->tbName.dbname, &p);
|
getStringFromAuthStr(p, pUserAuth->tbName.dbname, TSDB_DB_NAME_LEN, &p);
|
||||||
getStringFromAuthStr(p, pUserAuth->tbName.tname, &p);
|
getStringFromAuthStr(p, pUserAuth->tbName.tname, TSDB_TABLE_NAME_LEN, &p);
|
||||||
if (pUserAuth->tbName.tname[0]) {
|
if (pUserAuth->tbName.tname[0]) {
|
||||||
pUserAuth->tbName.type = TSDB_TABLE_NAME_T;
|
pUserAuth->tbName.type = TSDB_TABLE_NAME_T;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -91,11 +91,12 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int
|
||||||
*pLen = taosHashBinary(*ppKey, strlen(*ppKey));
|
*pLen = taosHashBinary(*ppKey, strlen(*ppKey));
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
*ppKey = taosMemoryCalloc(1, strlen(pVal->literal) + 1 + TSDB_COL_NAME_LEN + 1 + extraBufLen);
|
int32_t literalLen = strlen(pVal->literal);
|
||||||
|
*ppKey = taosMemoryCalloc(1, literalLen + 1 + TSDB_COL_NAME_LEN + 1 + extraBufLen);
|
||||||
if (!*ppKey) {
|
if (!*ppKey) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
TAOS_STRNCAT(*ppKey, pVal->literal, strlen(pVal->literal));
|
TAOS_STRNCAT(*ppKey, pVal->literal, literalLen);
|
||||||
TAOS_STRNCAT(*ppKey, ".", 2);
|
TAOS_STRNCAT(*ppKey, ".", 2);
|
||||||
TAOS_STRNCAT(*ppKey, ((SExprNode*)pNode)->aliasName, TSDB_COL_NAME_LEN);
|
TAOS_STRNCAT(*ppKey, ((SExprNode*)pNode)->aliasName, TSDB_COL_NAME_LEN);
|
||||||
*pLen = taosHashBinary(*ppKey, strlen(*ppKey));
|
*pLen = taosHashBinary(*ppKey, strlen(*ppKey));
|
||||||
|
|
Loading…
Reference in New Issue