#IAHKVH 告警清理,确保有符号整数运算不溢出

Signed-off-by: xuezhou_yan <yangang20@huawei.com>
This commit is contained in:
xuezhou_yan
2024-08-03 09:28:38 +08:00
parent 435e695a95
commit ac5122f95a
+1 -6
View File
@@ -358,7 +358,7 @@ static int32_t GetPriSyscapResult(cJSON *capVectorPtr, int32_t ret)
return ret;
}
int32_t GetPriSyscap(PCIDMain *pcidMain, cJSON *sysCapObject, size_t contextBufLen)
int32_t GetPriSyscap(PCIDMain *pcidMain, cJSON *sysCapObject, uint32_t contextBufLen)
{
cJSON *capVectorPtr = cJSON_CreateArray();
if (capVectorPtr == NULL) {
@@ -366,11 +366,6 @@ int32_t GetPriSyscap(PCIDMain *pcidMain, cJSON *sysCapObject, size_t contextBufL
return -1;
}
if (contextBufLen > UINT32_MAX) {
PRINT_ERR("the data privateSyscapLen is out of scope.");
return GetPriSyscapResult(capVectorPtr, -1);
}
int32_t privateSyscapLen = (int32_t)(contextBufLen - sizeof(PCIDMain) - 1);
if (privateSyscapLen < 0 || privateSyscapLen > INT32_MAX) {
PRINT_ERR("parse private syscap failed.");