fix bug #1393, "sortm core dumps", using patch provided by
authorGlenn Burkhardt <glenn@aoi.ultranet.com>
Mon, 30 Jun 2003 18:58:07 +0000 (18:58 +0000)
committerGlenn Burkhardt <glenn@aoi.ultranet.com>
Mon, 30 Jun 2003 18:58:07 +0000 (18:58 +0000)
Robert Elz, kre@munnari.oz.au.  The core dump occurred
when "Subject:" was immediately followed by an
alphanumeric, and "-textfield subject" were used
as arguments.

uip/sortm.c

index 5cff943..8f9bf81 100644 (file)
@@ -443,24 +443,23 @@ get_fields (char *datesw, int msg, struct smsg *smsg)
 
            cp = subjcomp;
            cp2 = subjcomp;
-           if (strcmp (subjsort, "subject") == 0)
+           if (strcmp (subjsort, "subject") == 0) {
                while ((c = *cp)) {
                    if (! isspace(c)) {
                        if(uprf(cp, "re:"))
                            cp += 2;
-                       else {
-                           if (isalnum(c))
-                               *cp2++ = isupper(c) ? tolower(c) : c;
+                       else
                            break;
-                       }
                    }
                    cp++;
                }
+           }
+
            while ((c = *cp++)) {
                if (isalnum(c))
                    *cp2++ = isupper(c) ? tolower(c) : c;
-
            }
+
            *cp2 = '\0';
        }
        else