mirror of https://github.com/openssl/openssl.git
template_kem.c: Check outlen before dereferencing it
Fixes Coverity 1633353, 1633356, 1633357 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Paul Dale <ppzgs1@gmail.com> (Merged from https://github.com/openssl/openssl/pull/26522)
This commit is contained in:
parent
bd0a2e0c1e
commit
2581ff619b
|
|
@ -143,7 +143,8 @@ static int template_encapsulate(void *vctx, unsigned char *out, size_t *outlen,
|
|||
*secretlen = 0; /* replace with real shared secret length */
|
||||
|
||||
if (out == NULL) {
|
||||
debug_print("encaps outlens set to %d and %d\n", *outlen, *secretlen);
|
||||
if (outlen != NULL && secretlen != NULL)
|
||||
debug_print("encaps outlens set to %d and %d\n", *outlen, *secretlen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +165,8 @@ static int template_decapsulate(void *vctx, unsigned char *out, size_t *outlen,
|
|||
*outlen = 0; /* replace with shared secret length */
|
||||
|
||||
if (out == NULL) {
|
||||
debug_print("decaps outlen set to %d \n", *outlen);
|
||||
if (outlen != NULL)
|
||||
debug_print("decaps outlen set to %d \n", *outlen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue