]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
multi-tenants: improve error handling (CID 1312702)
authorVictor Julien <victor@inliniac.net>
Tue, 23 Feb 2016 09:05:48 +0000 (10:05 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 23 Feb 2016 09:05:48 +0000 (10:05 +0100)
src/detect-engine.c

index cba76ca3698d14f0e3d4cd9eac364207c6a4e003..9763ae95bd2a1b10e149cc8f663b185bc28a61dc 100644 (file)
@@ -1334,7 +1334,9 @@ static TmEcode DetectEngineThreadCtxInitForMT(ThreadVars *tv, DetectEngineThread
             map_cnt = 0;
             map = master->tenant_mapping_list;
             while (map) {
-                BUG_ON(map_cnt > map_array_size);
+                if (map_cnt >= map_array_size) {
+                    goto error;
+                }
                 map_array[map_cnt].traffic_id = map->traffic_id;
                 map_array[map_cnt].tenant_id = map->tenant_id;
                 map_cnt++;
@@ -1351,7 +1353,9 @@ static TmEcode DetectEngineThreadCtxInitForMT(ThreadVars *tv, DetectEngineThread
                 DetectEngineThreadCtx *mt_det_ctx = DetectEngineThreadCtxInitForReload(tv, list, 0);
                 if (mt_det_ctx == NULL)
                     goto error;
-                BUG_ON(HashTableAdd(mt_det_ctxs_hash, mt_det_ctx, 0) != 0);
+                if (HashTableAdd(mt_det_ctxs_hash, mt_det_ctx, 0) != 0) {
+                    goto error;
+                }
             }
             list = list->next;
         }