Don't pass uninitialized pointer to ASN1_STRING_to_UTF8()
authortb <tb@openbsd.org>
Fri, 20 May 2022 07:58:54 +0000 (07:58 +0000)
committertb <tb@openbsd.org>
Fri, 20 May 2022 07:58:54 +0000 (07:58 +0000)
Exposed by recent rewrite of ASN1_STRING_to_UTF8().

CID 352831

ok jsing

lib/libcrypto/x509/x509_utl.c

index 0fa6ea6..47b25fe 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_utl.c,v 1.2 2020/09/13 15:06:17 beck Exp $ */
+/* $OpenBSD: x509_utl.c,v 1.3 2022/05/20 07:58:54 tb Exp $ */
 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project.
  */
@@ -954,7 +954,7 @@ do_check_string(ASN1_STRING *a, int cmp_type, equal_fn equal,
                        rv = -1;
        } else {
                int astrlen;
-               unsigned char *astr;
+               unsigned char *astr = NULL;
                astrlen = ASN1_STRING_to_UTF8(&astr, a);
                if (astrlen < 0)
                        return -1;