aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/pkcs12/p12_utl.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2001-01-10 01:06:31 +0000
committerDr. Stephen Henson <steve@openssl.org>2001-01-10 01:06:31 +0000
commitcbf0f45f90ce316360f07c8b6c5f37b913d9c24d (patch)
tree722770356da2ec03615d60123a1f65e269817cd0 /crypto/pkcs12/p12_utl.c
parentb2293b1e9bb0f2ddb9fdae8130f6103cce2df608 (diff)
downloadopenssl-cbf0f45f90ce316360f07c8b6c5f37b913d9c24d.tar.gz
Fix uni2asc() so it can properly convert zero length
unicode strings. Certain PKCS#12 files contain these in BMPStrings and it used to crash on them.
Diffstat (limited to 'crypto/pkcs12/p12_utl.c')
-rw-r--r--crypto/pkcs12/p12_utl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/pkcs12/p12_utl.c b/crypto/pkcs12/p12_utl.c
index 2c2166e8d7..8ed3e0d0c7 100644
--- a/crypto/pkcs12/p12_utl.c
+++ b/crypto/pkcs12/p12_utl.c
@@ -83,7 +83,7 @@ char *uni2asc (unsigned char *uni, int unilen)
char *asctmp;
asclen = unilen / 2;
/* If no terminating zero allow for one */
- if (uni[unilen - 1]) asclen++;
+ if (!unilen || uni[unilen - 1]) asclen++;
uni++;
if (!(asctmp = OPENSSL_malloc (asclen))) return NULL;
for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i];