From: PW Hu Date: Thu, 7 Oct 2021 03:50:59 +0000 (+0800) Subject: Fix unsafe BIO_get_md_ctx check X-Git-Tag: openssl-3.2.0-alpha1~3488 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=59a3e7b29574ff45f62e825f6e9923f45060f142;p=thirdparty%2Fopenssl.git Fix unsafe BIO_get_md_ctx check Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/16768) --- diff --git a/apps/dgst.c b/apps/dgst.c index 36a8c6fb084..bd23b76996e 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -335,7 +335,7 @@ int dgst_main(int argc, char **argv) EVP_PKEY_CTX *pctx = NULL; 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"); goto end; } @@ -362,7 +362,7 @@ int dgst_main(int argc, char **argv) /* we use md as a filter, reading from 'in' */ else { 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"); goto end; }