From 4cfc7f951c7cbd596849a1b942bc676132f97e15 Mon Sep 17 00:00:00 2001 From: Jiri Hruska Date: Tue, 12 Feb 2013 14:47:37 +0100 Subject: imap: Fixed escaping of mailbox names Used imap_atom() to escape mailbox names in imap_select(). --- lib/imap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/imap.c') 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; -- cgit v1.2.3