mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
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.
This commit is contained in:
parent
b2293b1e9b
commit
cbf0f45f90
4
CHANGES
4
CHANGES
@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
Changes between 0.9.6 and 0.9.7 [xx XXX 2000]
|
Changes between 0.9.6 and 0.9.7 [xx XXX 2000]
|
||||||
|
|
||||||
|
*) Fix to uni2asc() to cope with zero length Unicode strings.
|
||||||
|
These are present in some PKCS#12 files.
|
||||||
|
[Steve Henson]
|
||||||
|
|
||||||
*) Finish off removing the remaining LHASH function pointer casts.
|
*) Finish off removing the remaining LHASH function pointer casts.
|
||||||
There should no longer be any prototype-casting required when using
|
There should no longer be any prototype-casting required when using
|
||||||
the LHASH abstraction, and any casts that remain are "bugs". See
|
the LHASH abstraction, and any casts that remain are "bugs". See
|
||||||
|
@ -83,7 +83,7 @@ char *uni2asc (unsigned char *uni, int unilen)
|
|||||||
char *asctmp;
|
char *asctmp;
|
||||||
asclen = unilen / 2;
|
asclen = unilen / 2;
|
||||||
/* If no terminating zero allow for one */
|
/* If no terminating zero allow for one */
|
||||||
if (uni[unilen - 1]) asclen++;
|
if (!unilen || uni[unilen - 1]) asclen++;
|
||||||
uni++;
|
uni++;
|
||||||
if (!(asctmp = OPENSSL_malloc (asclen))) return NULL;
|
if (!(asctmp = OPENSSL_malloc (asclen))) return NULL;
|
||||||
for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i];
|
for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user