From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2012) id 514993858426; Tue, 30 Jan 2024 18:02:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 514993858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706637741; bh=cmD6oH50ypFQZLQV7gOBC16b0TClE9MXpjufCw70kPA=; h=From:To:Subject:Date:From; b=K8Tpy5GuG1aQeK5dzCj5CHrncqRn+mEm+5avdRD6vnuqZoQjJSre92X8TjH7QN+/v s3ENz0ipfd4STSv/vF0WpAeoWHGSpkSFrIaAPyxNGfiSzECYPJim9AaiA8eoJ2RFwo ps+pHfnLlNaFlW63M1fdD5ZmdZc6CcL25qQd/Xq4= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Arjun Shankar To: glibc-cvs@sourceware.org Subject: [glibc] syslog: Fix integer overflow in __vsyslog_internal (CVE-2023-6780) X-Act-Checkin: glibc X-Git-Author: Arjun Shankar X-Git-Refname: refs/heads/master X-Git-Oldrev: 7e5a0c286da33159d47d0122007aac016f3e02cd X-Git-Newrev: ddf542da94caf97ff43cc2875c88749880b7259b Message-Id: <20240130180221.514993858426@sourceware.org> Date: Tue, 30 Jan 2024 18:02:21 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ddf542da94caf97ff43cc2875c88749880b7259b commit ddf542da94caf97ff43cc2875c88749880b7259b Author: Arjun Shankar Date: Mon Jan 15 17:44:45 2024 +0100 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. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell Diff: --- misc/syslog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misc/syslog.c b/misc/syslog.c index 53440e47ad..4af87f54fd 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 */ @@ -219,7 +220,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)