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 <esyr@openssl.org>

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28546)
This commit is contained in:
Eugene Syromiatnikov 2025-09-15 03:31:31 +02:00 committed by Neil Horman
parent 0e9415d583
commit db28045104
1 changed files with 2 additions and 1 deletions

View File

@ -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)