]> granicus.if.org Git - sysstat/commit
Fix #153: sar program buffer overflow when options -s or -e specified
authorSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 24 May 2017 09:23:03 +0000 (11:23 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 24 May 2017 09:23:03 +0000 (11:23 +0200)
commitd74374282303ea97d36a90b5a6567d1d02cd3d18
tree3a44a149749b043aca7961e6bd8ae9cc19be17ab
parent3c553ec126fa32f126ad1526da8a6e733f2bfd7d
Fix #153: sar program buffer overflow when options -s or -e specified

When a short time format is used with sar's options -s or -e (e.g.,
sar -s 04:00), 5 characters are copied by strncpy in parse_timestamp
to timestamp variable. Unfortunately these 5 characters do not contain
the termination, therefore the following strcat appends after the
next "random" null byte. Therefore writing beyond the end of timestamp.

This patch tries to prevent this by explicitly terminating.

Debian bug #863197.

Reported-by: Robert Luberda
Signed-off-by: Bernhard Ubelacker <bernhardu@mailbox.org>
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sa_common.c