Cleanup (prevent repeated use of -p/-oMr to avoid mem leak)
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Wed, 31 May 2017 21:08:56 +0000 (23:08 +0200)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Wed, 28 Jun 2017 09:17:59 +0000 (11:17 +0200)
(cherry picked from commit 65e061b76867a9ea7aeeb535341b790b90ae6c21)
(cherry picked from commit 35a043657fa583a0ce96be9da4fff22cb0232c4e)

doc/doc-docbook/spec.xfpt
doc/doc-txt/ChangeLog
src/src/exim.c

index 7884440882f91df284cbb05eea00bc3a4e58ef92..afd690ab8531a95379f80c6e3236c3e60d255403 100644 (file)
@@ -4268,7 +4268,7 @@ or &%-bs%& is used. For &%-bh%&, the protocol is forced to one of the standard
 SMTP protocol names (see the description of &$received_protocol$& in section
 &<<SECTexpvar>>&). For &%-bs%&, the protocol is always &"local-"& followed by
 one of those same names. For &%-bS%& (batched SMTP) however, the protocol can
-be set by &%-oMr%&.
+be set by &%-oMr%&. Repeated use of this option is not supported.
 
 .vitem &%-oMs%&&~<&'host&~name'&>
 .oindex "&%-oMs%&"
@@ -4368,6 +4368,7 @@ host name and its colon can be omitted when only the protocol is to be set.
 Note the Exim already has two private options, &%-pd%& and &%-ps%&, that refer
 to embedded Perl. It is therefore impossible to set a protocol value of &`d`&
 or &`s`& using this option (but that does not seem a real limitation).
+Repeated use of this option is not supported.
 
 .vitem &%-q%&
 .oindex "&%-q%&"
index 5e407fc9dfd8dc11612a56a2fda829be7f200ac6..74414039f22872645de12f6267cfbbdac8ffec8a 100644 (file)
@@ -10,6 +10,8 @@ Exim version 4.89+fixes
 Cherry-Picked from the master development branch
 -------------------------------------------------
 
+HS/01 Cleanup, prevent repeated use of -p/-oMr (CVE-2017-1000369)
+
 
 Exim version 4.89
 -----------------
index a6a1ea82c3ae507eb1301a335749a642f60edc61..394bf84f09737cb8558cc2973c0cf4f6f297d237 100644 (file)
@@ -3092,7 +3092,14 @@ for (i = 1; i < argc; i++)
 
       /* -oMr: Received protocol */
 
-      else if (Ustrcmp(argrest, "Mr") == 0) received_protocol = argv[++i];
+      else if (Ustrcmp(argrest, "Mr") == 0)
+
+        if (received_protocol)
+          {
+          fprintf(stderr, "received_protocol is set already\n");
+          exit(EXIT_FAILURE);
+          }
+        else received_protocol = argv[++i];
 
       /* -oMs: Set sender host name */
 
@@ -3188,7 +3195,15 @@ for (i = 1; i < argc; i++)
 
     if (*argrest != 0)
       {
-      uschar *hn = Ustrchr(argrest, ':');
+      uschar *hn;
+
+      if (received_protocol)
+        {
+        fprintf(stderr, "received_protocol is set already\n");
+        exit(EXIT_FAILURE);
+        }
+
+      hn = Ustrchr(argrest, ':');
       if (hn == NULL)
         {
         received_protocol = argrest;