]> granicus.if.org Git - curl/commitdiff
imap: Fixed escaping of mailbox names
authorJiri Hruska <jirka@fud.cz>
Tue, 12 Feb 2013 13:47:37 +0000 (14:47 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Sat, 23 Feb 2013 15:42:33 +0000 (15:42 +0000)
Used imap_atom() to escape mailbox names in imap_select().

lib/imap.c

index 1c4f1fa8cd75e915e70c5b296c2c01892d1d806d..dce9f3016e530e0d6c7eb00517fe9ab28fc186f0 100644 (file)
@@ -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;