diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-06-18 05:22:38 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-06-18 05:22:38 +0000 |
commit | 66c3e410c52f4c0e69e842ba4e2d13e795707ee5 (patch) | |
tree | f195a8682fc3321ea4bb39ca105c872c9c14beae | |
parent | 73dd5c041f29cede8a9bc5482aa7e2ac7d7fb192 (diff) |
do_ext_i2d(): make various NULL checks explicit
ok jsing
-rw-r--r-- | lib/libcrypto/x509/x509_conf.c | 10 |
1 files 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); |