summaryrefslogtreecommitdiff
blob: c3d976a2b90710cc0f6718b02e18372fcefe878f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
CVE-2017-1000369

https://github.com/Exim/exim/commit/65e061b76867a9ea7aeeb535341b790b90ae6c21

--- a/doc/exim.8
+++ b/doc/exim.8
@@ -1350,7 +1350,7 @@ option sets the received protocol value that is stored in
 or \fB\-bs\fP is used. For \fB\-bh\fP, the protocol is forced to one of the standard
 SMTP protocol names. For \fB\-bs\fP, the protocol is always "local\-" followed by
 one of those same names. For \fB\-bS\fP (batched SMTP) however, the protocol can
-be set by \fB\-oMr\fP.
+be set by \fB\-oMr\fP. Repeated use of this option is not supported.
 .TP 10
 \fB\-oMs\fP <\fIhost name\fP>
 See \fB\-oMa\fP above for general remarks about the \fB\-oM\fP options. The \fB\-oMs\fP
@@ -1418,6 +1418,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, \fB\-pd\fP and \fB\-ps\fP, 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.
 .TP 10
 \fB\-q\fP
 This option is normally restricted to admin users. However, there is a
--- a/src/exim.c
+++ b/src/exim.c
@@ -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;