1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

imap: Simplified memcmp() in tagged response parsing

This commit is contained in:
Steve Holme 2013-02-24 12:45:04 +00:00
parent 797b004738
commit 7f5824a106

View File

@ -336,13 +336,14 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
/* Do we have a tagged command response? */
if(len >= id_len + 1 && !memcmp(id, line, id_len) && line[id_len] == ' ') {
len = len - id_len - 1;
line += id_len + 1;
len -= id_len + 1;
if(len >= 2 && !memcmp(line + id_len + 1, "OK", 2))
if(len >= 2 && !memcmp(line, "OK", 2))
*resp = 'O';
else if(len >= 2 && !memcmp(line + id_len + 1, "NO", 2))
else if(len >= 2 && !memcmp(line, "NO", 2))
*resp = 'N';
else if(len >= 3 && !memcmp(line + id_len + 1, "BAD", 3))
else if(len >= 3 && !memcmp(line, "BAD", 3))
*resp = 'B';
else {
failf(conn->data, "Bad tagged response");