]> git.ipfire.org Git - thirdparty/ulogd2.git/commit
ulogd: raise error on unknown config key
authorCorubba Smith <corubba@gmx.de>
Wed, 12 Mar 2025 19:09:36 +0000 (20:09 +0100)
committerFlorian Westphal <fw@strlen.de>
Wed, 12 Mar 2025 19:11:22 +0000 (20:11 +0100)
commit1b4e27768b375e646528a1b622391a95f8c25b25
treedb4a3efd53086a3b6d25d4dea8ec87dbaf9e1d09
parent15b89e41a5365adf81a6f2b70fbd733f0343c91b
ulogd: raise error on unknown config key

Until a6fbeb96e889 ("new configuration file syntax (Magnus Boden)")
this was already caught, and the enum member is still present.

Check if the for loop worked throught the whole array without hitting a
matching config option, and return with the unknown key error code.
Because there is no existing config_entry struct with that unknwon key
to use with the established config_errce pointer, allocate a new struct.
This potentially creates a memory leak if that config_entry is never
freed again, but for me that is acceptable in this rare case.

Since the memory allocation for the struct can fail, also reuse the old
out-of-memory error to indicate that.

Signed-off-by: Corubba Smith <corubba@gmx.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
src/conffile.c
src/ulogd.c