openssl: explicitly NULL initialize PKCS8_PRIV_KEY_INFO 96/269596/1 accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix accepted/tizen_8.0_unified accepted/tizen_unified tizen_7.0 tizen_7.0_hotfix tizen_8.0 accepted/tizen/7.0/unified/20221110.061109 accepted/tizen/7.0/unified/hotfix/20221116.110815 accepted/tizen/8.0/unified/20231005.094903 accepted/tizen/unified/20220124.125224 submit/tizen/20220119.040241 tizen_7.0_m2_release tizen_8.0_m2_release
authorDaniel Kolesa <daniel@octaforge.org>
Fri, 7 Jan 2022 05:47:04 +0000 (06:47 +0100)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 19 Jan 2022 03:08:31 +0000 (12:08 +0900)
Otherwise, PKCS8_PRIV_KEY_INFO_free will be called on an
uninitialized value if `!openssl->key` is true.

This results in WebKit TLS being broken at least with OpenSSL 3.x
and libsoup3.

Change-Id: I6cd3977f0c15c08a71600329de06f29081d66681
Part-of: <https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/201>

tls/openssl/gtlscertificate-openssl.c

index f3afc3d..7357c10 100644 (file)
@@ -144,7 +144,7 @@ export_privkey_to_der (GTlsCertificateOpenssl  *openssl,
                        guint8                 **output_data,
                        long                    *output_size)
 {
-  PKCS8_PRIV_KEY_INFO *pkcs8;
+  PKCS8_PRIV_KEY_INFO *pkcs8 = NULL;
   BIO *bio = NULL;
   const guint8 *data;