Subtract padding from outlen in ct_base64_decode
authorRob Percival <robpercival@google.com>
Wed, 19 Oct 2016 14:11:04 +0000 (15:11 +0100)
committerRob Percival <robpercival@google.com>
Wed, 16 Nov 2016 13:43:36 +0000 (13:43 +0000)
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1548)

crypto/ct/ct_b64.c

index d13d8f2af2e99849ea6568af2d77e699ba049ff0..636ac4f5d24ddff30e5b589008668d7554f02ad4 100644 (file)
@@ -45,6 +45,11 @@ static int ct_base64_decode(const char *in, unsigned char **out)
         goto err;
     }
 
+    /* Subtract padding bytes from |outlen| */
+    while (in[--inlen] == '=') {
+        --outlen;
+    }
+
     *out = outbuf;
     return outlen;
 err: