]> git.ipfire.org Git - thirdparty/ulogd2.git/commit
output: DBI: fix NUL-termination of escaped SQL string
authorJeremy Sowden <jeremy@azazel.net>
Tue, 30 Nov 2021 10:55:41 +0000 (10:55 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 6 Dec 2021 21:12:55 +0000 (22:12 +0100)
commitd429162387ce4fe12e7e35d911680cb1c37f2cd2
treee40665b21aa597cb99dfc2242501dea6b677cc2b
parent0a9fa5603a435afed955f5458a17331b7f2f18ca
output: DBI: fix NUL-termination of escaped SQL string

On error, `dbi_conn_quote_string_copy` returns zero.  In this case, we
need to set `*dst` to NUL.  Handle a return-value of `2` as normal
below.  `1` is never returned.

Replace `strncpy` with `memcpy`: using `strncpy` is nearly always a
mistake, and we don't need its special behaviour here.

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