mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
EC_KEY_priv2buf (): check parameter sanity
In EC_KEY_priv2buf(), check for pbuf sanity. If invoked with NULL, gracefully returns the key length. Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:
parent
219f3ca61c
commit
acae59bb29
@ -583,8 +583,8 @@ size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf)
|
|||||||
size_t len;
|
size_t len;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
len = EC_KEY_priv2oct(eckey, NULL, 0);
|
len = EC_KEY_priv2oct(eckey, NULL, 0);
|
||||||
if (len == 0)
|
if (len == 0 || pbuf == NULL)
|
||||||
return 0;
|
return len;
|
||||||
buf = OPENSSL_malloc(len);
|
buf = OPENSSL_malloc(len);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user