aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-08-05 17:59:32 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-08-05 19:01:55 +0100
commit7a4979815b3ce7d280ed30b3b1df2a23481c2331 (patch)
tree3c57c2c625191eb47ee920654ee504bb523c4fe0
parentd23de0bbf9e2c7a64065e2bf1907c6cceda78eb9 (diff)
downloadopenssl-OpenSSL_1_0_1-stable.tar.gz
Sanity check input length in OPENSSL_uni2asc().OpenSSL_1_0_1-stable
Thanks to Hanno Böck for reporting this bug. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 39a43280316f1b9c45be5ac5b04f4f5c3f923686) Conflicts: crypto/pkcs12/p12_utl.c
-rw-r--r--crypto/pkcs12/p12_utl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/pkcs12/p12_utl.c b/crypto/pkcs12/p12_utl.c
index a0b992eab6..e466f762ff 100644
--- a/crypto/pkcs12/p12_utl.c
+++ b/crypto/pkcs12/p12_utl.c
@@ -91,6 +91,10 @@ char *OPENSSL_uni2asc(unsigned char *uni, int unilen)
{
int asclen, i;
char *asctmp;
+
+ /* string must contain an even number of bytes */
+ if (unilen & 1)
+ return NULL;
asclen = unilen / 2;
/* If no terminating zero allow for one */
if (!unilen || uni[unilen - 1])