syslog: Fix heap buffer overflow in __vsyslog_internal (CVE-2023-6246) 30/305430/1 sandbox/vbarinov/cve accepted/tizen/base/x/20240214.091438
authorArjun Shankar <arjun@redhat.com>
Mon, 15 Jan 2024 16:44:43 +0000 (17:44 +0100)
committerSlava Barinov <v.barinov@samsung.com>
Thu, 1 Feb 2024 12:45:43 +0000 (15:45 +0300)
commit4b802a0eb069ff2dc5ce53128d63956498b24fb4
tree6db20ffd622d019a049eba0519a7d840306f09d4
parent6905bcb1ca7c4b101dcd1520099018212624c178
syslog: Fix heap buffer overflow in __vsyslog_internal (CVE-2023-6246)

__vsyslog_internal did not handle a case where printing a SYSLOG_HEADER
containing a long program name failed to update the required buffer
size, leading to the allocation and overflow of a too-small buffer on
the heap.  This commit fixes that.  It also adds a new regression test
that uses glibc.malloc.check.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Cherry-picked from: 6bd0e4efcc78f3c0115e5ea9739a1642807450da
Change-Id: Ieec10f1d29f4b5040a09cfd96aedcab0addc70fe
misc/Makefile
misc/syslog.c
misc/tst-syslog-long-progname.c [new file with mode: 0644]
misc/tst-syslog-long-progname.root/postclean.req [new file with mode: 0644]