--- mailutils-2.0/libproto/imap/folder.c.orig 2008-12-08 11:06:08.000000000 -0800 +++ mailutils-2.0/libproto/imap/folder.c 2009-02-19 22:40:55.000000000 -0800 @@ -2350,7 +2350,8 @@ /* The human-readable text contains a special alert that MUST be presented to the user in a fashion that calls the user's attention to the message. */ - mu_error (_("ALERT: %s"), (sp) ? sp : ""); + char *value = strtok_r (NULL, "", &sp1); + mu_error (_("ALERT: %s"), (value) ? value : ""); } else if (strcasecmp (subtag, "BADCHARSET") == 0) { @@ -2359,7 +2360,8 @@ is not supported by this implementation. If the optional list of charsets is given, this lists the charsets that are supported by this implementation. */ - mu_error (_("BAD CHARSET: %s"), (sp) ? sp : ""); + char *value = strtok_r (NULL, "", &sp1); + mu_error (_("BAD CHARSET: %s"), (value) ? value : ""); } else if (strcasecmp (subtag, "CAPABILITY") == 0) { @@ -2368,7 +2370,9 @@ initial capabilities list. This makes it unnecessary for a client to send a separate CAPABILITY command if it recognizes this response. */ - parse_capa (f_imap, cruft); + char *value = strtok_r (NULL, "", &sp1); + if (value) + parse_capa (f_imap, value); } else if (strcasecmp (subtag, "NEWNAME") == 0) { @@ -2378,14 +2382,16 @@ mailbox name. This is a hint to the client that the operation can succeed if the SELECT or EXAMINE is reissued with the new mailbox name. */ - mu_error ("NEWNAME: %s", (sp) ? sp : ""); + char *value = strtok_r (NULL, "", &sp1); + mu_error ("NEWNAME: %s", (value) ? value : ""); } else if (strcasecmp (subtag, "PARSE") == 0) { /* The human-readable text represents an error in parsing the [RFC-822] header or [MIME-IMB] headers of a message in the mailbox. */ - mu_error ("PARSE: %s", (sp) ? sp : ""); + char *value = strtok_r (NULL, "", &sp1); + mu_error ("PARSE: %s", (value) ? value : ""); } else if (strcasecmp (subtag, "PERMANENTFLAGS") == 0) { @@ -2421,30 +2427,35 @@ other reason). This is a hint to the client that the operation can succeed if the mailbox is first created by the CREATE command. */ - mu_error ("TRYCREATE: %s", (sp) ? sp : ""); + char *value = strtok_r (NULL, "", &sp1); + mu_error ("TRYCREATE: %s", (value) ? value : ""); } else if (strcasecmp (subtag, "UIDNEXT") == 0) { /* Followed by a decimal number, indicates the next unique identifier value. Refer to section 2.3.1.1 for more information. */ - char *value = strtok_r (NULL, " ", &sp); - f_imap->selected->uidnext = strtol (value, NULL, 10); + char *value = strtok_r (NULL, " ", &sp1); + if (value) + f_imap->selected->uidnext = strtol (value, NULL, 10); } else if (strcasecmp (subtag, "UIDVALIDITY") == 0) { /* Followed by a decimal number, indicates the unique identifier validity value. Refer to section 2.3.1.1 for more information. */ - char *value = strtok_r (NULL, " ", &sp); - f_imap->selected->uidvalidity = strtol (value, NULL, 10); + char *value = strtok_r (NULL, " ", &sp1); + if (value) + f_imap->selected->uidvalidity = strtol (value, + NULL, 10); } else if (strcasecmp (subtag, "UNSEEN") == 0) { /* Followed by a decimal number, indicates the number of the first message without the \Seen flag set. */ - char *value = strtok_r (NULL, " ", &sp); - f_imap->selected->unseen = strtol (value, NULL, 10); + char *value = strtok_r (NULL, " ", &sp1); + if (value) + f_imap->selected->unseen = strtol (value, NULL, 10); } else {