summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorJeremy Sowden <jeremy@azazel.net>2021-11-30 10:55:44 +0000
committerPablo Neira Ayuso <pablo@netfilter.org>2021-12-06 22:31:30 +0100
commit754d178b53a913b2ff4e2259cbca068a14a19777 (patch)
tree6fb072e7bab949159d4e529e29d3ec053886ce46 /configure.ac
parent33e2c5b2f63844a3e08fc287d0d8921cbc3b8f86 (diff)
output: PGSQL: improve mapping of DB columns to input-keys
Currently, we copy the column-name to a buffer, iterate over it to replace the underscores with full-stops, using `strchr` from the start of the buffer on each iteration, then copy the buffer to the input-key's `name` member. Apart from the inefficiency, `strncpy` is used to do the copies, which leads gcc to complain: ulogd_output_PGSQL.c:204:17: warning: `strncpy` output may be truncated copying 31 bytes from a string of length 31 Furthermore, the buffer is not initialized, which means that there is also a possible buffer overrun if the column-name is too long, since `strncpy` will not append a NUL. Instead, copy the column-name directly to the input-key using `snprintf`, and run `strchr` from the last underscore on each iteration. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'configure.ac')
0 files changed, 0 insertions, 0 deletions