]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1758 in SNORT/snort3 from ~KAMURTHI/snort3:DNS_QUERY to master
authorShravan Rangarajuvenkata (shrarang) <shrarang@cisco.com>
Tue, 24 Sep 2019 19:07:30 +0000 (15:07 -0400)
committerShravan Rangarajuvenkata (shrarang) <shrarang@cisco.com>
Tue, 24 Sep 2019 19:07:30 +0000 (15:07 -0400)
Squashed commit of the following:

commit 0c8de28d008b2812203326458452265f48fffeba
Author: kani <kamurthi@cisco.com>
Date:   Mon Sep 23 11:39:21 2019 -0400

    Appid: fix populating dns_query for DNS traffic

src/network_inspectors/appid/detector_plugins/detector_dns.cc

index 5d6be32840adbc6f7467e73321a68a3a55d35646..81d4986a911ec2929721f0cddd39d2a43456fe48 100644 (file)
@@ -267,13 +267,14 @@ void DnsValidator::add_dns_query_info(AppIdSession& asd, uint16_t id, const uint
     dsession->set_id(id);
     dsession->set_record_type(record_type);
 
-    if (!dsession->get_host())
+    if (!dsession->get_host_len())
     {
         if ((host != nullptr) && (host_len > 0) && (host_offset > 0))
         {
             char* new_host = dns_parse_host(host, host_len);
             dsession->set_host(new_host);
             dsession->set_host_offset(host_offset);
+            snort_free(new_host);
        }
     }
 }
@@ -293,13 +294,14 @@ void DnsValidator::add_dns_response_info(AppIdSession& asd, uint16_t id, const u
     dsession->set_ttl(ttl);
     dsession->set_response_type(response_type);
 
-    if (!dsession->get_host())
+    if (!dsession->get_host_len())
     {
         if ((host != nullptr) && (host_len > 0) && (host_offset > 0))
         {
             char* new_host = dns_parse_host(host, host_len);
             dsession->set_host(new_host);
             dsession->set_host_offset(host_offset);
+            snort_free(new_host);
         }
     }
 }