Blame SOURCES/mutt-2.0.7-cve-2022-1328.patch

fd0650
From e5ed080c00e59701ca62ef9b2a6d2612ebf765a5 Mon Sep 17 00:00:00 2001
fd0650
From: Kevin McCarthy <kevin@8t8.us>
fd0650
Date: Tue, 5 Apr 2022 11:05:52 -0700
fd0650
Subject: [PATCH] Fix uudecode buffer overflow.
fd0650
fd0650
mutt_decode_uuencoded() used each line's initial "length character"
fd0650
without any validation.  It would happily read past the end of the
fd0650
input line, and with a suitable value even past the length of the
fd0650
input buffer.
fd0650
fd0650
As I noted in ticket 404, there are several other changes that could
fd0650
be added to make the parser more robust.  However, to avoid
fd0650
accidentally introducing another bug or regression, I'm restricting
fd0650
this patch to simply addressing the overflow.
fd0650
fd0650
Thanks to Tavis Ormandy for reporting the issue, along with a sample
fd0650
message demonstrating the problem.
fd0650
---
fd0650
 handler.c | 4 ++--
fd0650
 1 file changed, 2 insertions(+), 2 deletions(-)
fd0650
fd0650
diff --git a/handler.c b/handler.c
fd0650
index d1b4bc73..c97cf0cb 100644
fd0650
--- a/handler.c
fd0650
+++ b/handler.c
fd0650
@@ -404,9 +404,9 @@ static void mutt_decode_uuencoded (STATE *s, LOFF_T len, int istext, iconv_t cd)
fd0650
     pt = tmps;
fd0650
     linelen = decode_byte (*pt);
fd0650
     pt++;
fd0650
-    for (c = 0; c < linelen;)
fd0650
+    for (c = 0; c < linelen && *pt;)
fd0650
     {
fd0650
-      for (l = 2; l <= 6; l += 2)
fd0650
+      for (l = 2; l <= 6 && *pt && *(pt + 1); l += 2)
fd0650
       {
fd0650
 	out = decode_byte (*pt) << l;
fd0650
 	pt++;
fd0650
-- 
fd0650
2.34.1
fd0650