]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1287 in SNORT/snort3 from apple_core_media to master
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Tue, 26 Jun 2018 20:27:15 +0000 (16:27 -0400)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Tue, 26 Jun 2018 20:27:15 +0000 (16:27 -0400)
Squashed commit of the following:

commit 615946c0d6235eeea84e52f31951737fd07f0336
Author: Masud Hasan <mashasan@cisco.com>
Date:   Mon Jun 25 13:19:55 2018 -0400

    appid: Fix identify_user_agent's default case

src/network_inspectors/appid/detector_plugins/http_url_patterns.cc

index 43a1f6b953340edf1965fbbed9eab619d929097f..0c57faec7e26190a80184888cf34dadefff55ac9 100644 (file)
@@ -282,7 +282,7 @@ static int match_query_elements(tMlpPattern* packetData, tMlpPattern* userPatter
 
     appVersion[0] = '\0';
 
-    if (!userPattern->pattern || !packetData->pattern)
+    if (!userPattern || !userPattern->pattern || !packetData || !packetData->pattern)
         return 0;
 
     // queryEnd is 1 past the end.  key1=value1&key2=value2
@@ -1405,6 +1405,10 @@ void HttpPatternMatchers::identify_user_agent(const char* start, int size, AppId
             default:
                 if (match->client_id)
                 {
+                    dominant_pattern_detected = 1;
+                    service_id = APP_ID_HTTP;
+                    client_id = match->client_id;
+
                     if (match->pattern_size <= longest_misc_match)
                         break;
                     longest_misc_match = match->pattern_size;
@@ -1430,9 +1434,6 @@ void HttpPatternMatchers::identify_user_agent(const char* start, int size, AppId
                         }
                         temp_ver[i] = 0;
                     }
-                    dominant_pattern_detected = 1;
-                    service_id = APP_ID_HTTP;
-                    client_id = match->client_id;
                 }
             }
         }