Import Debian changes 4.92-8+deb10u6
[hcoop/debian/exim4.git] / debian / patches / 84_16-Security-Check-overrun-rcpt_count-integer.patch
CommitLineData
0c0c20aa
AM
1From 56aadff97bc4e45e6a2ce25cfb9a98a4ae4bec79 Mon Sep 17 00:00:00 2001
2From: Qualys Security Advisory <qsa@qualys.com>
3Date: Sun, 21 Feb 2021 22:05:37 -0800
4Subject: [PATCH 16/29] Security: Check overrun rcpt_count integer
5
6Based on Heiko Schlittermann's commit e5cb5e61. This fixes:
7
84/ In src/smtp_in.c:
9
104966 case RCPT_CMD:
114967 HAD(SCH_RCPT);
124968 rcpt_count++;
13....
145123 if (rcpt_count > recipients_max && recipients_max > 0)
15
16In theory this recipients_max check can be bypassed, because the int
17rcpt_count can overflow (become negative). In practice this would either
18consume too much memory or generate too much network traffic, but maybe
19it should be fixed anyway.
20---
21 src/smtp_in.c | 2 ++
22 1 file changed, 2 insertions(+)
23
24diff --git a/src/smtp_in.c b/src/smtp_in.c
25index bdcfde65f..1a5fbfea3 100644
26--- a/src/smtp_in.c
27+++ b/src/smtp_in.c
28@@ -4993,6 +4993,8 @@ while (done <= 0)
29
30 case RCPT_CMD:
31 HAD(SCH_RCPT);
32+ if (rcpt_count < 0 || rcpt_count >= INT_MAX/2)
33+ log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Too many recipients: %d", rcpt_count);
34 rcpt_count++;
35 was_rcpt = fl.rcpt_in_progress = TRUE;
36
37--
382.30.2
39