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 d13d8f2..636ac4f 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: