Fix base64 decoding bug.
authorEric Young <eay@pobox.com>
Wed, 2 Apr 2014 18:50:33 +0000 (19:50 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 2 Apr 2014 18:57:57 +0000 (19:57 +0100)
A short PEM encoded sequence if passed to the BIO, and the file
had 2 \n following would fail.

PR#3289
(cherry picked from commit 10378fb5f4c67270b800e8f7c600cd0548874811)

crypto/evp/bio_b64.c

index 72a2a67277a32e9b470fe24a8eec7b68fb1d5850..ac6d441aadb9f623634b90d9bd51748c8e3071c2 100644 (file)
@@ -264,7 +264,7 @@ static int b64_read(BIO *b, char *out, int outl)
                                }
 
                        /* we fell off the end without starting */
-                       if (j == i)
+                       if ((j == i) && (num == 0))
                                {
                                /* Is this is one long chunk?, if so, keep on
                                 * reading until a new line. */