From 1bbe973c6b9db64355f4a75ff95cad241e1cca59 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 18 Jun 2024 05:22:37 +0000 Subject: [PATCH] do_ext_i2d(): make various NULL checks explicit ok jsing --- lib/libcrypto/x509/x509_conf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libcrypto/x509/x509_conf.c b/lib/libcrypto/x509/x509_conf.c index 30cf0b981c1..a491bb7c2b1 100644 --- a/lib/libcrypto/x509/x509_conf.c +++ b/lib/libcrypto/x509/x509_conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_conf.c,v 1.6 2024/06/18 05:19:01 tb Exp $ */ +/* $OpenBSD: x509_conf.c,v 1.7 2024/06/18 05:22:37 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -194,7 +194,7 @@ do_ext_i2d(const X509V3_EXT_METHOD *method, int ext_nid, int crit, X509_EXTENSION *ext; /* Convert internal representation to DER */ - if (method->it) { + if (method->it != NULL) { ext_der = NULL; ext_len = ASN1_item_i2d(ext_struc, &ext_der, method->it); if (ext_len < 0) @@ -202,18 +202,18 @@ do_ext_i2d(const X509V3_EXT_METHOD *method, int ext_nid, int crit, } else { unsigned char *p; ext_len = method->i2d(ext_struc, NULL); - if (!(ext_der = malloc(ext_len))) + if ((ext_der = malloc(ext_len)) == NULL) goto merr; p = ext_der; method->i2d(ext_struc, &p); } - if (!(ext_oct = ASN1_OCTET_STRING_new())) + if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL) goto merr; ext_oct->data = ext_der; ext_oct->length = ext_len; ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct); - if (!ext) + if (ext == NULL) goto merr; ASN1_OCTET_STRING_free(ext_oct); -- 2.20.1