diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-07-25 18:51:53 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-07-26 02:16:08 +0200 |
commit | 5a8635bca1b6d60a5b81c602eb4f0b7fd8902d7b (patch) | |
tree | a9a73cdf05ce487a174c9ef7ab334007348e7248 /source4/heimdal/lib/hcrypto | |
parent | f1a59f9d6f45987acd0304ee58e4488333faad18 (diff) | |
download | samba-5a8635bca1b6d60a5b81c602eb4f0b7fd8902d7b.tar.gz samba-5a8635bca1b6d60a5b81c602eb4f0b7fd8902d7b.tar.bz2 samba-5a8635bca1b6d60a5b81c602eb4f0b7fd8902d7b.zip |
s4:heimdal: import lorikeet-heimdal-201107241840 (commit 0fdf11fa3cdb47df9f5393ebf36d9f5742243036)
Diffstat (limited to 'source4/heimdal/lib/hcrypto')
-rw-r--r-- | source4/heimdal/lib/hcrypto/pkcs12.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source4/heimdal/lib/hcrypto/pkcs12.c b/source4/heimdal/lib/hcrypto/pkcs12.c index a890f01a3d..ff0f77644e 100644 --- a/source4/heimdal/lib/hcrypto/pkcs12.c +++ b/source4/heimdal/lib/hcrypto/pkcs12.c @@ -55,6 +55,13 @@ PKCS12_key_gen(const void *key, size_t keylen, unsigned char *outp = out; int i, vlen; + /** + * The argument key is pointing to an utf16 string, and thus + * keylen that is no a multiple of 2 is invalid. + */ + if (keylen & 1) + return 0; + ctx = EVP_MD_CTX_create(); if (ctx == NULL) return 0; @@ -83,7 +90,7 @@ PKCS12_key_gen(const void *key, size_t keylen, * empty string, in the empty string the UTF16 NUL terminator is * included into the string. */ - if (key && keylen >= 0) { + if (key) { for (i = 0; i < vlen / 2; i++) { I[(i * 2) + size_I] = 0; I[(i * 2) + size_I + 1] = ((unsigned char*)key)[i % (keylen + 1)]; |