Commit acae59bb authored by J Mohan Rao Arisankala's avatar J Mohan Rao Arisankala Committed by Rich Salz
Browse files

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: default avatarRich Salz <rsalz@openssl.org>
Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
parent 219f3ca6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;