v3_sxnet: add a check for the return of i2s_ASN1_INTEGER()
authorxkernel <xkernel.wang@foxmail.com>
Mon, 20 Jun 2022 09:46:39 +0000 (17:46 +0800)
committerRichard Levitte <levitte@openssl.org>
Tue, 5 Jul 2022 06:08:12 +0000 (08:08 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/18608)

crypto/x509/v3_sxnet.c

index a4331968206b3f3f3b94587defee88bad211e65f..5ac3bab354925e9acc4e5147c110b0cef777d8a0 100644 (file)
@@ -78,6 +78,8 @@ static int sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out,
     for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {
         id = sk_SXNETID_value(sx->ids, i);
         tmp = i2s_ASN1_INTEGER(NULL, id->zone);
+        if (tmp == NULL)
+            return 0;
         BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp);
         OPENSSL_free(tmp);
         ASN1_STRING_print(out, id->user);