bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-mailutils] imap[s] seg fault in mail[x]


From: Sergey Poznyakoff
Subject: Re: [bug-mailutils] imap[s] seg fault in mail[x]
Date: Wed, 18 Feb 2009 12:30:55 +0200

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
                    {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]