Skip to content

Commit abcf53f

Browse files
committed
patch curl for message name collision
1 parent 5eb16ce commit abcf53f

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

curl.dev.patch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
curl.test.patch

curl.test.patch

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
diff --git a/lib/imap.c b/lib/imap.c
2+
index e424cdb05..9b7318e42 100644
3+
--- a/lib/imap.c
4+
+++ b/lib/imap.c
5+
@@ -357,24 +357,24 @@ static bool imap_endofresp(struct Curl_easy *data, struct connectdata *conn,
6+
*/
7+
static CURLcode imap_get_message(struct Curl_easy *data, struct bufref *out)
8+
{
9+
- char *message = Curl_dyn_ptr(&data->conn->proto.imapc.pp.recvbuf);
10+
+ char *msg = Curl_dyn_ptr(&data->conn->proto.imapc.pp.recvbuf);
11+
size_t len = data->conn->proto.imapc.pp.nfinal;
12+
13+
if(len > 2) {
14+
/* Find the start of the message */
15+
len -= 2;
16+
- for(message += 2; *message == ' ' || *message == '\t'; message++, len--)
17+
+ for(msg += 2; *msg == ' ' || *msg == '\t'; msg++, len--)
18+
;
19+
20+
/* Find the end of the message */
21+
while(len--)
22+
- if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
23+
- message[len] != '\t')
24+
+ if(msg[len] != '\r' && msg[len] != '\n' && msg[len] != ' ' &&
25+
+ msg[len] != '\t')
26+
break;
27+
28+
/* Terminate the message */
29+
- message[++len] = '\0';
30+
- Curl_bufref_set(out, message, len, NULL);
31+
+ msg[++len] = '\0';
32+
+ Curl_bufref_set(out, msg, len, NULL);
33+
}
34+
else
35+
/* junk input => zero length output */
36+
diff --git a/lib/pop3.c b/lib/pop3.c
37+
index db6ec04c7..b28edbf62 100644
38+
--- a/lib/pop3.c
39+
+++ b/lib/pop3.c
40+
@@ -310,24 +310,24 @@ static bool pop3_endofresp(struct Curl_easy *data, struct connectdata *conn,
41+
*/
42+
static CURLcode pop3_get_message(struct Curl_easy *data, struct bufref *out)
43+
{
44+
- char *message = Curl_dyn_ptr(&data->conn->proto.pop3c.pp.recvbuf);
45+
+ char *msg = Curl_dyn_ptr(&data->conn->proto.pop3c.pp.recvbuf);
46+
size_t len = data->conn->proto.pop3c.pp.nfinal;
47+
48+
if(len > 2) {
49+
/* Find the start of the message */
50+
len -= 2;
51+
- for(message += 2; *message == ' ' || *message == '\t'; message++, len--)
52+
+ for(msg += 2; *msg == ' ' || *msg == '\t'; msg++, len--)
53+
;
54+
55+
/* Find the end of the message */
56+
while(len--)
57+
- if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
58+
- message[len] != '\t')
59+
+ if(msg[len] != '\r' && msg[len] != '\n' && msg[len] != ' ' &&
60+
+ msg[len] != '\t')
61+
break;
62+
63+
/* Terminate the message */
64+
- message[++len] = '\0';
65+
- Curl_bufref_set(out, message, len, NULL);
66+
+ msg[++len] = '\0';
67+
+ Curl_bufref_set(out, msg, len, NULL);
68+
}
69+
else
70+
/* junk input => zero length output */
71+
diff --git a/lib/smtp.c b/lib/smtp.c
72+
index d854d364f..49daeaa4e 100644
73+
--- a/lib/smtp.c
74+
+++ b/lib/smtp.c
75+
@@ -253,24 +253,24 @@ static bool smtp_endofresp(struct Curl_easy *data, struct connectdata *conn,
76+
*/
77+
static CURLcode smtp_get_message(struct Curl_easy *data, struct bufref *out)
78+
{
79+
- char *message = Curl_dyn_ptr(&data->conn->proto.smtpc.pp.recvbuf);
80+
+ char *msg = Curl_dyn_ptr(&data->conn->proto.smtpc.pp.recvbuf);
81+
size_t len = data->conn->proto.smtpc.pp.nfinal;
82+
83+
if(len > 4) {
84+
/* Find the start of the message */
85+
len -= 4;
86+
- for(message += 4; *message == ' ' || *message == '\t'; message++, len--)
87+
+ for(msg += 4; *msg == ' ' || *msg == '\t'; msg++, len--)
88+
;
89+
90+
/* Find the end of the message */
91+
while(len--)
92+
- if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
93+
- message[len] != '\t')
94+
+ if(msg[len] != '\r' && msg[len] != '\n' && msg[len] != ' ' &&
95+
+ msg[len] != '\t')
96+
break;
97+
98+
/* Terminate the message */
99+
- message[++len] = '\0';
100+
- Curl_bufref_set(out, message, len, NULL);
101+
+ msg[++len] = '\0';
102+
+ Curl_bufref_set(out, msg, len, NULL);
103+
}
104+
else
105+
/* junk input => zero length output */

0 commit comments

Comments
 (0)