mirror of
https://github.com/openssl/openssl.git
synced 2025-04-24 20:51:14 +08:00
Fix unsafe BIO_get_md_ctx check
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16768)
This commit is contained in:
parent
0c75a7387d
commit
59a3e7b295
@ -335,7 +335,7 @@ int dgst_main(int argc, char **argv)
|
|||||||
EVP_PKEY_CTX *pctx = NULL;
|
EVP_PKEY_CTX *pctx = NULL;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (!BIO_get_md_ctx(bmd, &mctx)) {
|
if (BIO_get_md_ctx(bmd, &mctx) <= 0) {
|
||||||
BIO_printf(bio_err, "Error getting context\n");
|
BIO_printf(bio_err, "Error getting context\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ int dgst_main(int argc, char **argv)
|
|||||||
/* we use md as a filter, reading from 'in' */
|
/* we use md as a filter, reading from 'in' */
|
||||||
else {
|
else {
|
||||||
EVP_MD_CTX *mctx = NULL;
|
EVP_MD_CTX *mctx = NULL;
|
||||||
if (!BIO_get_md_ctx(bmd, &mctx)) {
|
if (BIO_get_md_ctx(bmd, &mctx) <= 0) {
|
||||||
BIO_printf(bio_err, "Error getting context\n");
|
BIO_printf(bio_err, "Error getting context\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user