Fri Dec 27 08:06:37 PST 2002 This patch report sent to: mpack-bugs at andrew dot cmu dot edu This patch available at: http://www.unixwiz.net/patches/mpack-1.5-patch.txt This is a patch to to mpack-1.5 to fix a bug where it unpacks to an incorrect filename in some circumstances. If the beginning of a MIME part looks like: Content-Type: text/plain; charset=us-ascii; name=foo.txt; Content-Disposition: attachment; filename=foo.txt; <--- look here If the filename is not quoted, the semicolon gets included as part of the filename and later converted to an "X" before saving. So "foo.txt" saves as "foo.txtX". A quick read of the MIME RFCs suggest that this code is legitimate, so we can't really fault the MIME generator. Looking at the getDispositionFilename() function in decode.c shows what looks like an out-and-out typo: /* If we're looking at a ";", we found what we're looking for */ if (*disposition++ == '=') break; The comment says semicolon, but the code says equal: making the code match the comment seems to fix it: if (*disposition++ == ';') break; Steve Friedl / steve at unixwiz dot net / www.unixwiz.net This patch created with: date cat ../mpack-patch-header echo echo "This patch created with:" echo sed 's/^/ /' < ../make-mpack-patch echo echo LC_ALL=C TZ=UTC0 diff -Naur version.h.orig version.h LC_ALL=C TZ=UTC0 diff -Naur decode.c.orig decode.c --- version.h.orig 2002-12-27 15:19:54.467097001 +0000 +++ version.h 2002-12-27 15:20:03.326937002 +0000 @@ -22,4 +22,4 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -#define MPACK_VERSION "1.5" +#define MPACK_VERSION "1.5a" --- decode.c.orig 2002-12-27 15:18:17.038697001 +0000 +++ decode.c 2002-12-27 15:18:54.538057006 +0000 @@ -552,7 +552,7 @@ if (!disposition) return 0; /* If we're looking at a ";", we found what we're looking for */ - if (*disposition++ == '=') break; + if (*disposition++ == ';') break; } SkipWhitespace(&disposition);