]> git.ipfire.org Git - thirdparty/ulogd2.git/commit
db: fix back-log capacity checks
authorJeremy Sowden <jeremy@azazel.net>
Sat, 3 Dec 2022 19:02:12 +0000 (19:02 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 8 Dec 2022 20:56:01 +0000 (21:56 +0100)
commitbda63ec0e99aaf591470ce2d23aa794d3d6c77ed
treefeaea4f0a42657700f9ffb81f868f26fa16622ab
parent2ae7a3f96563c6cf3ea21445e7958314b6ca20fb
db: fix back-log capacity checks

Hitherto, when adding queries to the back-log, the memory usage has been
incremented and decremented by the size of the query structure and the
length of the SQL statement, `sizeof(struct db_stmt) + len`.  However,
when checking whether there is available capacity to add a new query,
the struct size has been ignored.  Amend the check to include the struct
size, and also account for the NULL that terminates the SQL.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
util/db.c