bug-mailutils
[Top][All Lists]
Advanced

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

[bug-mailutils] Patch: fix handling of NUL in imap4d


From: Jordi Mallach
Subject: [bug-mailutils] Patch: fix handling of NUL in imap4d
Date: Mon, 4 Dec 2006 13:59:09 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Ben came up with a patch to fix the problem we discussed a few weeks
ago. It only fixes imap4d, while you said other tools are affected too.

Jordi

diff -u mailutils-1.1+dfsg1/debian/changelog 
mailutils-1.1+dfsg1/debian/changelog
--- mailutils-1.1+dfsg1/debian/changelog
+++ mailutils-1.1+dfsg1/debian/changelog
@@ -1,3 +1,11 @@
+mailutils (1:1.1+dfsg1-3.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Fix issue with mails containing \0. Thanks to Ben Hutchings for
+    the patch. Closes: #361354
+
+ -- Andreas Barth <address@hidden>  Mon,  4 Dec 2006 11:21:05 +0000
+
 mailutils (1:1.1+dfsg1-3) unstable; urgency=medium
 
   * debian/control: switch back to guile-1.6 as guile-1.8 is not yet ready
only in patch2:
unchanged:
--- mailutils-1.1+dfsg1.orig/imap4d/fetch.c
+++ mailutils-1.1+dfsg1/imap4d/fetch.c
@@ -1160,12 +1160,11 @@
       offset = 0;
       if (max)
        {
-         util_send (" {%u}\r\n", max);
+         util_send (" {%lu}\r\n", max);
          while (mu_stream_read (rfc, buffer, sizeof (buffer) - 1, offset,
                              &n) == 0 && n > 0)
            {
-             buffer[n] = '\0';
-             util_send ("%s", buffer);
+             util_send_raw (buffer, n);
              offset += n;
            }
        }
@@ -1190,13 +1189,11 @@
          end -= n;
          buffer += n;
        }
-      /* Make sure we null terminate.  */
-      *buffer = '\0';
       util_send ("<%lu>", start);
       if (total)
        {
          util_send (" {%s}\r\n", mu_umaxtostr (0, total));
-         util_send ("%s", p);
+         util_send_raw (p, total);
        }
       else
        util_send (" \"\"");
only in patch2:
unchanged:
--- mailutils-1.1+dfsg1.orig/imap4d/imap4d.h
+++ mailutils-1.1+dfsg1/imap4d/imap4d.h
@@ -245,6 +245,7 @@
 extern int  util_send (const char *, ...);
 extern int  util_send_qstring (const char *);
 extern int  util_send_literal (const char *);
+extern int  util_send_raw (const char *, size_t);
 extern int  util_start (char *);
 extern int  util_finish (struct imap4d_command *, int, const char *, ...);
 extern int  util_getstate (void);
only in patch2:
unchanged:
--- mailutils-1.1+dfsg1.orig/imap4d/util.c
+++ mailutils-1.1+dfsg1/imap4d/util.c
@@ -398,6 +398,15 @@
   return util_send ("{%u}\r\n%s", strlen (buffer), buffer);
 }
 
+int
+util_send_raw (const char *data, size_t len)
+{
+  if (daemon_param.transcript)
+    syslog (LOG_DEBUG, "sent: %s", data);
+
+  return mu_stream_sequential_write (ostream, data, len);
+}
+
 /* Send an unsolicited response.  */
 int
 util_out (int rc, const char *format, ...)

-- 
Jordi Mallach PĂ©rez  --  Debian developer     http://www.debian.org/
address@hidden     address@hidden     http://www.sindominio.net/
GnuPG public key information available at http://oskuro.net/

Attachment: signature.asc
Description: Digital signature


reply via email to

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