aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-02-24 12:45:04 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-02-24 12:45:04 +0000
commit7f5824a106b926b46ebfd3d4963d9508f0fd62d1 (patch)
tree1b6ba440f33f89969ae5182c663e57dc384b6d24
parent797b004738407a88e4891ab6fe0d9ab62f621427 (diff)
imap: Simplified memcmp() in tagged response parsing
-rw-r--r--lib/imap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/imap.c b/lib/imap.c
index b2c97136d..7d978b634 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -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");