mirror of
https://github.com/moparisthebest/curl
synced 2025-03-11 07:39:50 -04:00
imap: Simplified memcmp() in tagged response parsing
This commit is contained in:
parent
797b004738
commit
7f5824a106
@ -336,13 +336,14 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
|
|||||||
|
|
||||||
/* Do we have a tagged command response? */
|
/* Do we have a tagged command response? */
|
||||||
if(len >= id_len + 1 && !memcmp(id, line, id_len) && line[id_len] == ' ') {
|
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';
|
*resp = 'O';
|
||||||
else if(len >= 2 && !memcmp(line + id_len + 1, "NO", 2))
|
else if(len >= 2 && !memcmp(line, "NO", 2))
|
||||||
*resp = 'N';
|
*resp = 'N';
|
||||||
else if(len >= 3 && !memcmp(line + id_len + 1, "BAD", 3))
|
else if(len >= 3 && !memcmp(line, "BAD", 3))
|
||||||
*resp = 'B';
|
*resp = 'B';
|
||||||
else {
|
else {
|
||||||
failf(conn->data, "Bad tagged response");
|
failf(conn->data, "Bad tagged response");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user