1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

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().
This commit is contained in:
Steve Holme 2013-03-06 19:33:49 +00:00
parent 9d0af3018c
commit b7f39156d4

View File

@ -748,9 +748,15 @@ static CURLcode imap_fetch(struct connectdata *conn)
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct IMAP *imap = conn->data->state.proto.imap; 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 */ /* Send the FETCH command */
result = imap_sendf(conn, "FETCH %s BODY[%s]", result = imap_sendf(conn, "FETCH %s BODY[%s]",
imap->uid ? imap->uid : "1", imap->uid,
imap->section ? imap->section : ""); imap->section ? imap->section : "");
if(!result) if(!result)