Merge branch 'debian'
[hcoop/debian/exim4.git] / debian / patches / 79_CVE-2017-1000369.patch
1 commit 65e061b76867a9ea7aeeb535341b790b90ae6c21
2 Author: Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
3 Date: Wed May 31 23:08:56 2017 +0200
4
5 Cleanup (prevent repeated use of -p/-oMr to avoid mem leak)
6
7 diff --git a/src/exim.c b/src/exim.c
8 index 67583e5..88e1197 100644
9 --- a/src/exim.c
10 +++ b/src/exim.c
11 @@ -3106,7 +3106,14 @@ for (i = 1; i < argc; i++)
12
13 /* -oMr: Received protocol */
14
15 - else if (Ustrcmp(argrest, "Mr") == 0) received_protocol = argv[++i];
16 + else if (Ustrcmp(argrest, "Mr") == 0)
17 +
18 + if (received_protocol)
19 + {
20 + fprintf(stderr, "received_protocol is set already\n");
21 + exit(EXIT_FAILURE);
22 + }
23 + else received_protocol = argv[++i];
24
25 /* -oMs: Set sender host name */
26
27 @@ -3202,7 +3209,15 @@ for (i = 1; i < argc; i++)
28
29 if (*argrest != 0)
30 {
31 - uschar *hn = Ustrchr(argrest, ':');
32 + uschar *hn;
33 +
34 + if (received_protocol)
35 + {
36 + fprintf(stderr, "received_protocol is set already\n");
37 + exit(EXIT_FAILURE);
38 + }
39 +
40 + hn = Ustrchr(argrest, ':');
41 if (hn == NULL)
42 {
43 received_protocol = argrest;