From ca8572c1897f8c2426eecc71ceac99cdfbda34ff Mon Sep 17 00:00:00 2001 From: GNU Libc Maintainers Date: Tue, 6 Feb 2024 22:41:45 +0000 Subject: [PATCH] local-CVE-2023-6780 syslog: Fix integer overflow in __vsyslog_internal (CVE-2023-6780) __vsyslog_internal calculated a buffer size by adding two integers, but did not first check if the addition would overflow. This commit fixes that. Gbp-Pq: Topic any Gbp-Pq: Name local-CVE-2023-6780.patch --- misc/syslog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misc/syslog.c b/misc/syslog.c index 3108ae913..933603666 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -41,6 +41,7 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94"; #include #include #include +#include static int LogType = SOCK_DGRAM; /* type of socket connection */ static int LogFile = -1; /* fd for log */ @@ -217,7 +218,7 @@ __vsyslog_internal (int pri, const char *fmt, va_list ap, vl = __vsnprintf_internal (pos, len, fmt, apc, mode_flags); va_end (apc); - if (vl < 0) + if (vl < 0 || vl >= INT_MAX - l) goto out; if (vl >= len) -- 2.30.2