Hi Paul,

> However, it seems to be a bug that the third argument to strtok_r()
> in lines 2431, 2439, and 2446 of libproto/imap/folder.c is &sp instead
> of &sp1.

Yes, it definitely is. Please try the attached patch. Does it work for
you?

Regards,
Sergey

diff --git a/libproto/imap/folder.c b/libproto/imap/folder.c
index 944e9b2..2a9e6bb 100644
--- a/libproto/imap/folder.c
+++ b/libproto/imap/folder.c
@@ -2428,23 +2428,27 @@ imap_parse (f_imap_t f_imap)
 		      /* 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
 		    {
_______________________________________________
Bug-mailutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-mailutils

Reply via email to