summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2017-11-28 18:20:58 -0500
committerLeo Famulari <leo@famulari.name>2017-11-28 18:22:49 -0500
commit48adc61c148a30f3fe7bcd6a2dea82b21694a8c9 (patch)
tree27aa67e413ed5c7f8e348a4a6e143443e102a96c
parent38faa2b54663f253cdb18f414f13b249b346d767 (diff)
downloadguix-48adc61c148a30f3fe7bcd6a2dea82b21694a8c9.tar.gz
gnu: exim: Fix CVE-2017-16944.
* gnu/packages/patches/exim-CVE-2017-16944.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/mail.scm (exim)[source]: Use it.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/mail.scm1
-rw-r--r--gnu/packages/patches/exim-CVE-2017-16944.patch87
3 files changed, 89 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index eaf7514931..13acb6797c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -616,6 +616,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/eudev-rules-directory.patch		\
   %D%/packages/patches/evilwm-lost-focus-bug.patch		\
   %D%/packages/patches/exim-CVE-2017-16943.patch		\
+  %D%/packages/patches/exim-CVE-2017-16944.patch		\
   %D%/packages/patches/exim-CVE-2017-1000369.patch		\
   %D%/packages/patches/exiv2-CVE-2017-14860.patch		\
   %D%/packages/patches/exiv2-CVE-2017-14859-14862-14864.patch	\
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index fbe39bef76..b9656c7dd8 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1043,6 +1043,7 @@ delivery.")
                   (string-append "ftp://ftp.exim.org/pub/exim/exim4/old/exim-"
                                  version ".tar.bz2")))
        (patches (search-patches "exim-CVE-2017-16943.patch"
+                                "exim-CVE-2017-16944.patch"
                                 "exim-CVE-2017-1000369.patch"))
        (sha256
         (base32
diff --git a/gnu/packages/patches/exim-CVE-2017-16944.patch b/gnu/packages/patches/exim-CVE-2017-16944.patch
new file mode 100644
index 0000000000..e4e8313c9c
--- /dev/null
+++ b/gnu/packages/patches/exim-CVE-2017-16944.patch
@@ -0,0 +1,87 @@
+Fix CVE-2017-16944:
+
+https://bugs.exim.org/show_bug.cgi?id=2201
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-16944
+
+Patch copied from upstream source repository:
+
+https://git.exim.org/exim.git/commit/4804c62909a62a3ac12ec4777ebd48c541028965
+
+From 4804c62909a62a3ac12ec4777ebd48c541028965 Mon Sep 17 00:00:00 2001
+From: "Heiko Schlittermann (HS12-RIPE)" <hs@schlittermann.de>
+Date: Mon, 27 Nov 2017 22:42:33 +0100
+Subject: [PATCH] Chunking: do not treat the first lonely dot special.
+ CVE-2017-16944, Bug 2201
+
+(cherry picked from commit 178ecb70987f024f0e775d87c2f8b2cf587dd542)
+
+Change log update
+
+(cherry picked from commit b488395f4d99d44a950073a64b35ec8729102782)
+---
+ doc/doc-txt/ChangeLog | 6 +++++-
+ src/src/receive.c     | 2 +-
+ src/src/smtp_in.c     | 7 +++++++
+ 3 files changed, 13 insertions(+), 2 deletions(-)
+
+#diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
+#index a2d9339..541ebaf 100644
+#--- a/doc/doc-txt/ChangeLog
+#+++ b/doc/doc-txt/ChangeLog
+#@@ -61,7 +61,11 @@ JH/30 Fix a logging bug on aarch64: an unsafe routine was previously used for
+# 
+# JH/34 Bug 2199: fix a use-after-free while reading smtp input for header lines.
+#       A crafted sequence of BDAT commands could result in in-use memory beeing
+#-      freed.
+#+      freed.  CVE-2017-16943.
+#+
+#+HS/03 Bug 2201: Fix checking for leading-dot on a line during headers reading
+#+      from SMTP input.  Previously it was always done; now only done for DATA
+#+      and not BDAT commands.  CVE-2017-16944.
+# 
+# 
+# Exim version 4.89
+diff --git a/src/src/receive.c b/src/src/receive.c
+index 20672db..2812ea2 100644
+--- a/src/receive.c
++++ b/src/receive.c
+@@ -1827,7 +1827,7 @@ for (;;)
+   prevent further reading), and break out of the loop, having freed the
+   empty header, and set next = NULL to indicate no data line. */
+ 
+-  if (ptr == 0 && ch == '.' && (smtp_input || dot_ends))
++  if (ptr == 0 && ch == '.' && dot_ends)
+     {
+     ch = (receive_getc)(GETC_BUFFER_UNLIMITED);
+     if (ch == '\r')
+diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
+index 1b45f84..0207540 100644
+--- a/src/smtp_in.c
++++ b/src/smtp_in.c
+@@ -4955,16 +4955,23 @@ while (done <= 0)
+       DEBUG(D_receive) debug_printf("chunking state %d, %d bytes\n",
+ 				    (int)chunking_state, chunking_data_left);
+ 
++      /* push the current receive_* function on the "stack", and
++      replace them by bdat_getc(), which in turn will use the lwr_receive_*
++      functions to do the dirty work. */
+       lwr_receive_getc = receive_getc;
+       lwr_receive_ungetc = receive_ungetc;
++
+       receive_getc = bdat_getc;
+       receive_ungetc = bdat_ungetc;
+ 
++      dot_ends = FALSE;
++
+       goto DATA_BDAT;
+       }
+ 
+     case DATA_CMD:
+     HAD(SCH_DATA);
++    dot_ends = TRUE;
+ 
+     DATA_BDAT:		/* Common code for DATA and BDAT */
+     if (!discarded && recipients_count <= 0)
+-- 
+1.9.1
+