bug-mailutils
[Top][All Lists]
Advanced

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

[bug-mailutils] [PATCH] Broken base64 encoder in imap4d/util.c


From: Simon Josefsson
Subject: [bug-mailutils] [PATCH] Broken base64 encoder in imap4d/util.c
Date: Thu, 15 Jan 2004 07:42:13 +0100
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Apparently the reason nobody has noticed this earlier is that the
function is only used by auth_gss.c.

Rant: Perhaps it would be better to move util_base64* somewhere else
in mailutils, so there is only one version to maintain.  I also note
the base64 decoder in imap4d/util.c doesn't detect subliminal
channels, another argument for having just one (correct) base64
implementation present.  The base64 decoder in glibc does this.

2004-01-15  Simon Josefsson  <address@hidden>

        * imap4d/util.c (util_base64_encode): Produce correct results.

Index: util.c
===================================================================
RCS file: /cvsroot/mailutils/mailutils/imap4d/util.c,v
retrieving revision 1.57
diff -u -p -u -w -r1.57 util.c
--- util.c      26 Sep 2003 23:10:14 -0000      1.57
+++ util.c      15 Jan 2004 06:36:56 -0000
@@ -887,10 +887,10 @@ util_base64_encode (const unsigned char 
     {
       unsigned char c = (input[0] << 4) & 0x30;
       *out++ = b64tab[input[0] >> 2];
-      if (input_len > 0)
+      if (input_len > 1)
        c |= input[1] >> 4;
       *out++ = b64tab[c];
-      *out++ = (input_len < 2) ? '-' : b64tab[(input[1] << 2) & 0x3c];
+      *out++ = (input_len < 2) ? '=' : b64tab[(input[1] << 2) & 0x3c];
       *out++ = '=';
     }
   *output_len = out - *output;





reply via email to

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