X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=imap%2Fcommand.c;h=141af125b43a43470c5237487b99b5abbae869eb;hb=777c7ccc259a8b7f5fadac70267c59e62a2cb300;hp=e10de38c3d71774ab1a355e852d0c0341207cd43;hpb=e96efa56257b45e9c3d1fb1b30071c57512cfe28;p=apps%2Fmadmutt.git diff --git a/imap/command.c b/imap/command.c index e10de38..141af12 100644 --- a/imap/command.c +++ b/imap/command.c @@ -21,6 +21,10 @@ /* command.c: routines for sending commands to an IMAP server and parsing * responses */ +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include "mutt.h" #include "imap_private.h" #include "message.h" @@ -408,7 +412,7 @@ static int cmd_handle_untagged (IMAP_DATA* idata) /* cmd_make_sequence: make a tag suitable for starting an IMAP command */ static void cmd_make_sequence (IMAP_DATA* idata) { - snprintf (idata->cmd.seq, sizeof (idata->cmd.seq), "a%04d", idata->seqno++); + snprintf (idata->cmd.seq, sizeof (idata->cmd.seq), "a%04u", idata->seqno++); if (idata->seqno > 9999) idata->seqno = 0; @@ -481,19 +485,20 @@ static void cmd_parse_fetch (IMAP_DATA* idata, char* s) msgno = atoi (s); + if (msgno <= idata->ctx->msgcount) /* see cmd_parse_expunge */ - for (cur = 0; cur < idata->ctx->msgcount; cur++) - { - h = idata->ctx->hdrs[cur]; - - if (h->active && h->index+1 == msgno) + for (cur = 0; cur < idata->ctx->msgcount; cur++) { - dprint (2, (debugfile, "Message UID %d updated\n", HEADER_DATA(h)->uid)); - break; + h = idata->ctx->hdrs[cur]; + + if (h->active && h->index+1 == msgno) + { + dprint (2, (debugfile, "Message UID %d updated\n", HEADER_DATA(h)->uid)); + break; + } + + h = NULL; } - - h = NULL; - } if (!h) {