Package: mpack
Version: 1.6-6
Severity: important
Tags: patch

  Here is a patch to fix removal of carriage returns.

--- decode.c    2003-07-21 20:47:54.000000000 +0000
+++ decode.c.new        2012-07-31 16:55:18.421337917 +0000
@@ -46,7 +46,7 @@
 params ParseContent(char **headerp);
 char *getParam(params cParams, char *key);
 char *getDispositionFilename(char *disposition);
-void from64(struct part *inpart, FILE *outfile, char **digestp, int 
suppressCR);
+void from64(struct part *inpart, FILE *outfile, char **digestp);
 void fromqp(struct part *inpart, FILE *outfile, char **digestp);
 void fromnone(struct part *inpart, FILE *outfile, char **digestp);
 /*
@@ -883,7 +883,7 @@
        break;
 
     case enc_base64:
-       from64(inpart, descfile, (char **)0, 1);
+       from64(inpart, descfile, (char **)0);
        break;
     }
 
@@ -898,14 +898,10 @@
 {
     FILE *outfile = 0;
     int flags = 0;
-    int suppressCR = 0;
     char *outputmd5;
     char *fname;
 
-    if (!strncasecmp(contentType, "text/", 5)) {
-       suppressCR = 1;
-    }
-    else if (contentEncoding == enc_base64) {
+    if (contentEncoding == enc_base64) {
        /*
         * HEURISTIC: It is not in general possible to determine whether
         * any non-text content type is line-oriented.  We guess
@@ -944,7 +940,7 @@
        break;
 
     case enc_base64:
-       from64(inpart, outfile, &outputmd5, suppressCR);
+       from64(inpart, outfile, &outputmd5);
        break;
     }
     rewind(outfile);
@@ -1008,7 +1004,7 @@
 };
 #define CHAR64(c)  (index_64[(unsigned char)(c)])
 
-void from64(struct part *inpart, FILE *outfile, char **digestp, int suppressCR)
+void from64(struct part *inpart, FILE *outfile, char **digestp)
 {
     int c1, c2, c3, c4;
     int DataDone = 0;
@@ -1041,21 +1037,21 @@
         c1 = CHAR64(c1);
         c2 = CHAR64(c2);
        buf[0] = ((c1<<2) | ((c2&0x30)>>4));
-        if (!suppressCR || buf[0] != '\r') putc(buf[0], outfile);
+        putc(buf[0], outfile);
         if (c3 == '=') {
            if (digestp) MD5Update(&context, buf, 1);
             DataDone = 1;
         } else {
             c3 = CHAR64(c3);
            buf[1] = (((c2&0x0F) << 4) | ((c3&0x3C) >> 2));
-            if (!suppressCR || buf[1] != '\r') putc(buf[1], outfile);
+            putc(buf[1], outfile);
             if (c4 == '=') {
                if (digestp) MD5Update(&context, buf, 2);
                 DataDone = 1;
             } else {
                 c4 = CHAR64(c4);
                buf[2] = (((c3&0x03) << 6) | c4);
-                if (!suppressCR || buf[2] != '\r') putc(buf[2], outfile);
+                putc(buf[2], outfile);
                if (digestp) MD5Update(&context, buf, 3);               
             }
         }
@@ -1079,7 +1075,7 @@
                c2 = part_getc(inpart);
                c2 = HEXCHAR(c2);
                c = c1<<4 | c2;
-               if (c != '\r') putc(c, outfile);
+               putc(c, outfile);
                if (digestp) MD5Update(&context, &c, 1);
            }
        } else {

-- 
Bjarni I. Gislason


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to