summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2023-07-12 21:38:12 +0800
committerliuxueli <[email protected]>2023-07-12 21:38:12 +0800
commit65cf6fb1a3bd447203ae1f8a0603233b0cedbe16 (patch)
tree0a967f66457f830faaa4266fb3960856c188d7ec /src
parentdfd450c80026598daa1d346a6497e7bc92a6b40d (diff)
ASAN检查存在非法读
Diffstat (limited to 'src')
-rw-r--r--src/tsg_rule.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tsg_rule.cpp b/src/tsg_rule.cpp
index 7593070..1c43ae7 100644
--- a/src/tsg_rule.cpp
+++ b/src/tsg_rule.cpp
@@ -275,7 +275,10 @@ static int get_data_center(char *accept_tag, char *effective_tag_key, char *data
if(item!=NULL)
{
cJSON *tag_item=cJSON_GetObjectItem(item, "tag");
- if(tag_item!=NULL && tag_item->valuestring!=NULL && (memcmp(effective_tag_key, tag_item->valuestring, strlen(effective_tag_key)))==0)
+ if(tag_item!=NULL &&
+ tag_item->valuestring!=NULL &&
+ strlen(effective_tag_key)==strlen(tag_item->valuestring) &&
+ (memcmp(effective_tag_key, tag_item->valuestring, strlen(effective_tag_key)))==0)
{
cJSON *v_item=cJSON_GetObjectItem(item, "value");
if(v_item!=NULL && v_item->valuestring!=NULL)