aboutsummaryrefslogtreecommitdiff
path: root/lib/imap.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-03-06 19:33:49 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-03-06 19:33:49 +0000
commitb7f39156d4bc6307e61617db3b17af35f9cddb5a (patch)
treea714f6db9cfabc6c1bd214c694d28437b40c636a /lib/imap.c
parent9d0af3018c5db25f5adda216dbcad6056b4a3107 (diff)
imap: Added check for empty UID in FETCH command
As the UID has to be specified by the user for the FETCH command to work correctly, added a check to imap_fetch(), although strictly speaking it is protected by the call from imap_perform().
Diffstat (limited to 'lib/imap.c')
-rw-r--r--lib/imap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 4a4f0a3c2..c2f065acb 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -748,9 +748,15 @@ static CURLcode imap_fetch(struct connectdata *conn)
CURLcode result = CURLE_OK;
struct IMAP *imap = conn->data->state.proto.imap;
+ /* Check we have a UID */
+ if(!imap->uid) {
+ failf(conn->data, "Cannot FETCH without a UID.");
+ return CURLE_URL_MALFORMAT;
+ }
+
/* Send the FETCH command */
result = imap_sendf(conn, "FETCH %s BODY[%s]",
- imap->uid ? imap->uid : "1",
+ imap->uid,
imap->section ? imap->section : "");
if(!result)