aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Hruska <jirka@fud.cz>2013-02-12 14:47:37 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-02-23 15:42:33 +0000
commit4cfc7f951c7cbd596849a1b942bc676132f97e15 (patch)
tree39778c22a1d5cc486fdf6dcc1f29ed80469bee73
parentfcf02cbb7588d7a7639221d98b8aaf4c8479d822 (diff)
imap: Fixed escaping of mailbox names
Used imap_atom() to escape mailbox names in imap_select().
-rw-r--r--lib/imap.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 1c4f1fa8c..dce9f3016 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -1089,9 +1089,15 @@ static CURLcode imap_select(struct connectdata *conn)
CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data;
struct IMAP *imap = data->state.proto.imap;
+ char *mailbox;
- result = imap_sendf(conn, "SELECT %s",
- imap->mailbox ? imap->mailbox : "");
+ mailbox = imap_atom(imap->mailbox ? imap->mailbox : "");
+ if(!mailbox)
+ result = CURLE_OUT_OF_MEMORY;
+ else
+ result = imap_sendf(conn, "SELECT %s", mailbox);
+
+ Curl_safefree(mailbox);
if(result)
return result;