From: Arjun Shankar <arjun@redhat.com>
To: libc-alpha@sourceware.org
Cc: Arjun Shankar <arjun@redhat.com>, Carlos O'Donell <carlos@redhat.com>
Subject: [COMMITTED 3/4] syslog: Fix integer overflow in __vsyslog_internal (CVE-2023-6780)
Date: Tue, 30 Jan 2024 19:40:43 +0100 [thread overview]
Message-ID: <20240130184045.511720-3-arjun@redhat.com> (raw)
In-Reply-To: <20240130184045.511720-1-arjun@redhat.com>
__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 <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
---
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 <sys/uio.h>
#include <sys/un.h>
#include <syslog.h>
+#include <limits.h>
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)
--
2.43.0
next prev parent reply other threads:[~2024-01-30 18:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 18:40 [COMMITTED 1/4] syslog: Fix heap buffer overflow in __vsyslog_internal (CVE-2023-6246) Arjun Shankar
2024-01-30 18:40 ` [COMMITTED 2/4] syslog: Fix heap buffer overflow in __vsyslog_internal (CVE-2023-6779) Arjun Shankar
2024-01-30 18:40 ` Arjun Shankar [this message]
2024-01-30 18:40 ` [COMMITTED 4/4] Document CVE-2023-6246, CVE-2023-6779, and CVE-2023-6780 Arjun Shankar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240130184045.511720-3-arjun@redhat.com \
--to=arjun@redhat.com \
--cc=carlos@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).