]> git.ipfire.org Git - thirdparty/suricata.git/commit
conf: avoid quadratic complexity 10874/head
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 21 Mar 2024 08:38:25 +0000 (09:38 +0100)
committerPhilippe Antoine <pantoine@oisf.net>
Wed, 17 Apr 2024 10:57:19 +0000 (12:57 +0200)
commit26a5357e76339a1b81ca6ddb2181cde37ec70002
tree7de6ceee7116b850e3f023427b675371b6cfcf8a
parent6be6d53bc609adfd2670f5ddb78cfde2981d1224
conf: avoid quadratic complexity

Ticket: 6878

Follow up on 15649424a76d01eb332d85620ffc4956d4f3d9be

When adding many sequence nodes, either from start or scalar event

We add "sequence nodes" whose name is an integer cf sequence_node_name
and then run ConfNodeLookupChild to see if it had been already set
(from the command line cf comment in the code)
And ConfNodeLookupChild iterates the whole linked list...

1. We add node 1
2. To add node 2, we check if node 1 equals this new node
3. To add node 3, we check if nodes 1, or 2 equals this new node's name
And so on...

This commits avoids these checks ig the list is empty at the beginning

(cherry picked from commit 240e068b81275e287ffe6555d4c457a0b3916066)
src/conf-yaml-loader.c