From db28045104312c89b57c85be6ce0ca91f193989c Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Mon, 15 Sep 2025 03:31:31 +0200 Subject: [PATCH] crypto/x509/t_x509.c: check i2d_X509_NAME() return value in X509_ocspid_print() There is little reason for this call to fail, but there is also little reason for not to check for it, and, since Coverity noticed that the check is missing, just add it. Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665420 References: https://github.com/openssl/project/issues/1432 Signed-off-by: Eugene Syromiatnikov Reviewed-by: Paul Dale Reviewed-by: Matt Caswell Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/28546) --- crypto/x509/t_x509.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/x509/t_x509.c b/crypto/x509/t_x509.c index b7be0b22915..9ae2c4bc776 100644 --- a/crypto/x509/t_x509.c +++ b/crypto/x509/t_x509.c @@ -222,7 +222,8 @@ int X509_ocspid_print(BIO *bp, const X509 *x) goto err; if ((der = dertmp = OPENSSL_malloc(derlen)) == NULL) goto err; - i2d_X509_NAME(subj, &dertmp); + if (i2d_X509_NAME(subj, &dertmp) < 0) + goto err; md = EVP_MD_fetch(x->libctx, SN_sha1, x->propq); if (md == NULL) -- 2.47.3