Skip to content

Commit 65e061b

Browse files
HeikoSchlittermannJeremy Harris
authored and
Jeremy Harris
committed
Cleanup (prevent repeated use of -p/-oMr to avoid mem leak)
1 parent 31323b3 commit 65e061b

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

Diff for: doc/doc-docbook/spec.xfpt

+2-1
Original file line numberDiff line numberDiff line change
@@ -4274,7 +4274,7 @@ or &%-bs%& is used. For &%-bh%&, the protocol is forced to one of the standard
42744274
SMTP protocol names (see the description of &$received_protocol$& in section
42754275
&<<SECTexpvar>>&). For &%-bs%&, the protocol is always &"local-"& followed by
42764276
one of those same names. For &%-bS%& (batched SMTP) however, the protocol can
4277-
be set by &%-oMr%&.
4277+
be set by &%-oMr%&. Repeated use of this option is not supported.
42784278

42794279
.vitem &%-oMs%&&~<&'host&~name'&>
42804280
.oindex "&%-oMs%&"
@@ -4374,6 +4374,7 @@ host name and its colon can be omitted when only the protocol is to be set.
43744374
Note the Exim already has two private options, &%-pd%& and &%-ps%&, that refer
43754375
to embedded Perl. It is therefore impossible to set a protocol value of &`d`&
43764376
or &`s`& using this option (but that does not seem a real limitation).
4377+
Repeated use of this option is not supported.
43774378

43784379
.vitem &%-q%&
43794380
.oindex "&%-q%&"

Diff for: src/src/exim.c

+17-2
Original file line numberDiff line numberDiff line change
@@ -3106,7 +3106,14 @@ for (i = 1; i < argc; i++)
31063106

31073107
/* -oMr: Received protocol */
31083108

3109-
else if (Ustrcmp(argrest, "Mr") == 0) received_protocol = argv[++i];
3109+
else if (Ustrcmp(argrest, "Mr") == 0)
3110+
3111+
if (received_protocol)
3112+
{
3113+
fprintf(stderr, "received_protocol is set already\n");
3114+
exit(EXIT_FAILURE);
3115+
}
3116+
else received_protocol = argv[++i];
31103117

31113118
/* -oMs: Set sender host name */
31123119

@@ -3202,7 +3209,15 @@ for (i = 1; i < argc; i++)
32023209

32033210
if (*argrest != 0)
32043211
{
3205-
uschar *hn = Ustrchr(argrest, ':');
3212+
uschar *hn;
3213+
3214+
if (received_protocol)
3215+
{
3216+
fprintf(stderr, "received_protocol is set already\n");
3217+
exit(EXIT_FAILURE);
3218+
}
3219+
3220+
hn = Ustrchr(argrest, ':');
32063221
if (hn == NULL)
32073222
{
32083223
received_protocol = argrest;

0 commit comments

Comments
 (0)