]> git.itanic.dy.fi Git - rrdd/commit
Fix possible buffer overrun due to incorrect strncat length argument
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Tue, 15 Nov 2016 17:44:47 +0000 (19:44 +0200)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Tue, 15 Nov 2016 17:44:47 +0000 (19:44 +0200)
commitf1f186534e252c72aff958ea5db4f387b075d73e
tree4f4395e4425a1c617c5e4c6337623445c80800d7
parent247b9c8873ea60fd3d67c85eb730e088a35cdac5
Fix possible buffer overrun due to incorrect strncat length argument

The strncat usage assumed that the length argument to strncat
indicates the length of the destination buffer. That is how strlcat
works. The length argument for strncat instead describes the maximum
number of characters to copy from the source buffer.

To make the call sites work correctly when we want to avoid
overflowing the destination buffer, we need to subtract also the
current length of the destination buffer string.

This also cures possible overflow issues with any of the strncat use
sites.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
plugin_manager.c
rrdtool.c