Hello. One small bug in reformime

Chis-Serban Dinu-Razvan <[email protected]> Thu, 9 Aug 2018 09:51:41 +0300
Newsgroups gmane.mail.maildrop
Message-ID <CACesFmJ2Q2WQOPRvDY0QhdXNzO75YBzTROAZ8HyWw=_XPRynDQ@mail.gmail.com>
Hello. I have found a bug in reformime which generates a SIGSEGV

Description of problem:
When trying to extract MIME parts from an email reformime exits with SIGSEGV.

Version-Release number of selected component (if applicable):
2.9.1

How reproducible:
every time

Steps to Reproduce:
1. lunch reformime with -x parameter and read MIME data from STDIN
2.
3.

Actual results:
generates SIGSEGV

Expected results:
the extracted info with the prefix specified by -x

Additional info:
-a patch for that:

--- reformime.c 2016-08-04 04:27:23.000000000 +0300
+++ reformime.c 2018-08-08 12:34:26.606676452 +0300
@@ -1164,10 +1164,11 @@
        }
        else if (dodecode)
        {
-               mimesection = strtok(section,",");
+               mimesection = section ? strtok(section, ","):NULL;
                do {
                        print_decode(p, mimesection);
-                       mimesection = strtok(NULL,",");
+                       if (mimesection)
+                               mimesection = strtok(NULL,",");
                } while (mimesection != NULL);
        }
        else if (dorewrite)
@@ -1176,11 +1177,12 @@
                dsn(p, dodsn == 2);
        else if (do_extract)
        {
-               mimesection = strtok(section,",");
+               mimesection = section ? strtok(section, ","):NULL;
                do {
                        extract_section(p, mimesection, extract_filename,
                                        argc-argn, argv+argn, do_extract);
-                       mimesection = strtok(NULL,",");
+                       if (mimesection)
+                               mimesection = strtok(NULL,",");
                } while (mimesection != NULL);
        }
        else if (dovalidate)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Courier-maildrop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/courier-maildrop