Fix regression in i2d_re_X509_REQ_tbs()
authorTomas Mraz <tomas@openssl.org>
Thu, 29 Sep 2022 11:00:45 +0000 (13:00 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 5 Oct 2022 14:13:03 +0000 (16:13 +0200)
This fixes regression from commit 8e39049. There is also no point
in setting the modified flag after just calling i2d.

Fixes #19297

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/19299)

(cherry picked from commit 928f15e71b0bccabb10cbdcbb9b2d4e85eeb5906)

crypto/x509/x509_req.c

index ad48f34a308006ebd876d7bdbc4ecf3a13b26867..9a6872a8a25bfae91f08c29c746f67c1122b1785 100644 (file)
@@ -326,8 +326,6 @@ int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp)
         ERR_raise(ERR_LIB_X509, ERR_R_PASSED_NULL_PARAMETER);
         return 0;
     }
-    if (!i2d_X509_REQ_INFO(&req->req_info, pp))
-        return 0;
     req->req_info.enc.modified = 1;
-    return 1;
+    return i2d_X509_REQ_INFO(&req->req_info, pp);
 }