From ac52e8869135c01cf1b4f53f38cef19786c9ec2a Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Tue, 4 Oct 2016 15:54:54 +0200 Subject: [PKCS8]: Distinguish between no password and an empty string. --- crypto/pkcs8/pkcs8.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crypto/pkcs8/pkcs8.c b/crypto/pkcs8/pkcs8.c index 175a8855..85af2063 100644 --- a/crypto/pkcs8/pkcs8.c +++ b/crypto/pkcs8/pkcs8.c @@ -83,6 +83,12 @@ static int ascii_to_ucs2(const char *ascii, size_t ascii_len, uint8_t *unitmp; size_t ulen, i; + if (!ascii) { + *out = NULL; + *out_len = 0; + return 1; + } + ulen = ascii_len * 2 + 2; if (ulen < ascii_len) { return 0; -- cgit v1.2.3