]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
gtls: check the return value of gnutls_pubkey_init()
authorx2018 <xkernel.wang@foxmail.com>
Tue, 4 Nov 2025 15:27:49 +0000 (23:27 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 4 Nov 2025 16:00:52 +0000 (17:00 +0100)
Closes #19362

lib/vtls/gtls.c

index c79f192e823fd09816d6e12059b9da6468724324..40d8ad5b45e00691cf1820c293daf7ebec57debf 100644 (file)
@@ -1291,8 +1291,10 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data,
   do {
     int ret;
 
-    /* Begin Gyrations to get the public key     */
-    gnutls_pubkey_init(&key);
+    /* Begin Gyrations to get the public key */
+    ret = gnutls_pubkey_init(&key);
+    if(ret < 0)
+      break; /* failed */
 
     ret = gnutls_pubkey_import_x509(key, cert, 0);
     if(ret < 0)