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
1 changed files with 2 additions and 2 deletions
|
@ -583,8 +583,8 @@ size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf)
|
|||
size_t len;
|
||||
unsigned char *buf;
|
||||
len = EC_KEY_priv2oct(eckey, NULL, 0);
|
||||
if (len == 0)
|
||||
return 0;
|
||||
if (len == 0 || pbuf == NULL)
|
||||
return len;
|
||||
buf = OPENSSL_malloc(len);
|
||||
if (buf == NULL)
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue