Fix for base64 BIO decoding bug
authorDr. Stephen Henson <steve@openssl.org>
Sat, 2 Oct 1999 13:33:06 +0000 (13:33 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 2 Oct 1999 13:33:06 +0000 (13:33 +0000)
CHANGES
STATUS
crypto/evp/bio_b64.c

diff --git a/CHANGES b/CHANGES
index 1885ba65b6377524c5d0c8ca125e54e938c9960f..fcd0147ba4837cdfdd74791fbb9208b7665b8e32 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,20 @@
 
  Changes between 0.9.4 and 0.9.5  [xx XXX 1999]
 
 
  Changes between 0.9.4 and 0.9.5  [xx XXX 1999]
 
+  *) Fix for base64 decode bug. When a base64 bio reads only one line of
+     data and it contains EOF it will end up returning an error. This is
+     caused by input 46 bytes long. The cause is due to the way base64
+     BIOs find the start of base64 encoded data. They do this by trying a
+     trial decode on each line until they find one that works. When they
+     do a flag is set and it starts again knowing it can pass all the
+     data directly through the decoder. Unfortunately it doesn't reset
+     the context it uses. This means that if EOF is reached an attempt
+     is made to pass two EOFs through the context and this causes the
+     resulting error. This can also cause other problems as well. As is
+     usual with these problems it takes *ages* to find and the fix is
+     trivial: move one line.
+     [Steve Henson, reported by ian@uns.ns.ac.yu (Ivan Nejgebauer) ]
+
   *) Ugly workaround to get s_client and s_server working under Windows. The
      old code wouldn't work because it needed to select() on sockets and the
      tty (for keypresses and to see if data could be written). Win32 only
   *) Ugly workaround to get s_client and s_server working under Windows. The
      old code wouldn't work because it needed to select() on sockets and the
      tty (for keypresses and to see if data could be written). Win32 only
diff --git a/STATUS b/STATUS
index 60bb06bd06e9d9560feac3e92a7689ce5b916c50..fddbdba7229002ae585d5cd517441a10600eba2b 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,6 +1,6 @@
 
   OpenSSL STATUS                           Last modified at
 
   OpenSSL STATUS                           Last modified at
-  ______________                           $Date: 1999/09/30 08:32:54 $
+  ______________                           $Date: 1999/10/02 13:33:03 $
 
   DEVELOPMENT STATE
 
 
   DEVELOPMENT STATE
 
@@ -60,7 +60,6 @@
   NEEDS PATCH
 
     o  Arne Ansper: d2i_ASN1_bytes bug
   NEEDS PATCH
 
     o  Arne Ansper: d2i_ASN1_bytes bug
-    o  base64 decoding bug (Ivan Nejgebauer)
     o  salzr@certco.com (Rich Salz): Bug in X509_name_print
        <29E0A6D39ABED111A36000A0C99609CA2C2BA4@macertco-srv1.ma.certco.com>
     o  $(PERL) in */Makefile.ssl
     o  salzr@certco.com (Rich Salz): Bug in X509_name_print
        <29E0A6D39ABED111A36000A0C99609CA2C2BA4@macertco-srv1.ma.certco.com>
     o  $(PERL) in */Makefile.ssl
index 84729119df24f4f381bfa12b19cc8e25b070fb9b..913bafa5f79e60aa3308d38e985054b42bdfc037 100644 (file)
@@ -237,8 +237,8 @@ static int b64_read(BIO *b, char *out, int outl)
                                                        &(ctx->tmp[0]));
                                                for (x=0; x < i; x++)
                                                        ctx->tmp[x]=p[x];
                                                        &(ctx->tmp[0]));
                                                for (x=0; x < i; x++)
                                                        ctx->tmp[x]=p[x];
-                                               EVP_DecodeInit(&ctx->base64);
                                                }
                                                }
+                                       EVP_DecodeInit(&ctx->base64);
                                        ctx->start=0;
                                        break;
                                        }
                                        ctx->start=0;
                                        break;
                                        }