summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2021-12-03 10:57:44 +0300
committerliuxueli <[email protected]>2021-12-03 10:57:44 +0300
commit20270fad396935fd72ea2569cc0650c0ab09ffb8 (patch)
treeae623ec20e063b5eed567adabccf5a7831c4161a
parent78a8b137405bad026a44b595e91fbd36c811600d (diff)
TSG-8786: DNS应答资源记录中rdlength为空且未对rdata置空,构造应答资源记录字段时访问非法内存导致SAPP重启v2.1.2
-rw-r--r--src/dns.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index c77f37a..0b958fc 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -212,7 +212,7 @@ int get_rr_str2json(cJSON *object, dns_info_t *dns_info, int *dns_sec)
cJSON_AddNumberToObject(one_rr_object, "rdlength", dns_rr->rdlength);
}
- if(dns_rr->rdata.a==NULL)
+ if(dns_rr->rdata.a==NULL || dns_rr->rdlength==0)
{
cJSON_AddItemToArray(dns_rr_array, one_rr_object);
continue;
@@ -1801,6 +1801,7 @@ int parse_resource_record(struct streaminfo *a_stream, dns_info_t *dns_info, cha
if(dns_info->rr[i].rdlength==0)
{
+ memset(dns_info->rr[i].rdata.cname, 0, sizeof(dns_info->rr[i].rdata.cname));
continue;
}