]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3678: appid: Fixed addition of duplicate entries in app_info_table
authorSreeja Athirkandathil Narayanan (sathirka) <sathirka@cisco.com>
Tue, 29 Nov 2022 15:05:42 +0000 (15:05 +0000)
committerSreeja Athirkandathil Narayanan (sathirka) <sathirka@cisco.com>
Tue, 29 Nov 2022 15:05:42 +0000 (15:05 +0000)
Merge in SNORT/snort3 from ~BSACHDEV/snort3:apptablefix to master

Squashed commit of the following:

commit 51e60c3e20024038a9c24366aca543730f21293b
Author: bsachdev <bsachdev@cisco.com>
Date:   Wed Nov 23 12:40:45 2022 -0500

    appid: Fixed addition of duplicate entries in app_info_table

src/network_inspectors/appid/app_info_table.cc

index 4cc357126449502ee65596c6dffa6a8f2429a45d..3f66b37c84db688c3845559614848f80dbeec2e0 100644 (file)
@@ -720,21 +720,22 @@ void AppInfoManager::init_appid_info_table(const AppIdConfig& config,
             if (token)
                 entry->snort_protocol_id = add_appid_protocol_reference(token, sc);
 
-            if ((app_id = get_static_app_info_entry(entry->appId)))
-            {
-                app_info_table[app_id] = entry;
-                AppIdPegCounts::add_app_peg_info(entry->app_name_key, app_id);
-            }
-
-            if ((app_id = get_static_app_info_entry(entry->serviceId)))
-                app_info_service_table[app_id] = entry;
-            if ((app_id = get_static_app_info_entry(entry->clientId)))
-                app_info_client_table[app_id] = entry;
-            if ((app_id = get_static_app_info_entry(entry->payloadId)))
-                app_info_payload_table[app_id] = entry;
-
             if (!add_entry_to_app_info_name_table(entry->app_name_key, entry))
                 delete entry;
+            else 
+            {
+                if ((app_id = get_static_app_info_entry(entry->appId)))
+                {
+                    app_info_table[app_id] = entry;
+                    AppIdPegCounts::add_app_peg_info(entry->app_name_key, app_id);
+                }
+                if ((app_id = get_static_app_info_entry(entry->serviceId)))
+                    app_info_service_table[app_id] = entry;
+                if ((app_id = get_static_app_info_entry(entry->clientId)))
+                    app_info_client_table[app_id] = entry;
+                if ((app_id = get_static_app_info_entry(entry->payloadId)))
+                    app_info_payload_table[app_id] = entry;
+            }
         }
         fclose(tableFile);