mirror of https://github.com/openssl/openssl.git
pvkkdf: Always reset buflen after clearing the buffer
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17164)
This commit is contained in:
parent
d2217c88df
commit
a632bfaa4e
|
@ -97,13 +97,15 @@ static int pvk_set_membuf(unsigned char **buffer, size_t *buflen,
|
|||
const OSSL_PARAM *p)
|
||||
{
|
||||
OPENSSL_clear_free(*buffer, *buflen);
|
||||
*buffer = NULL;
|
||||
*buflen = 0;
|
||||
|
||||
if (p->data_size == 0) {
|
||||
if ((*buffer = OPENSSL_malloc(1)) == NULL) {
|
||||
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
} else if (p->data != NULL) {
|
||||
*buffer = NULL;
|
||||
if (!OSSL_PARAM_get_octet_string(p, (void **)buffer, 0, buflen))
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue