From: x2018 Date: Tue, 4 Nov 2025 15:27:49 +0000 (+0800) Subject: gtls: check the return value of gnutls_pubkey_init() X-Git-Tag: curl-8_17_0~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8d4530537aa6223f5f7360da2dbe5a94660821ed;p=thirdparty%2Fcurl.git gtls: check the return value of gnutls_pubkey_init() Closes #19362 --- diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c index c79f192e82..40d8ad5b45 100644 --- a/lib/vtls/gtls.c +++ b/lib/vtls/gtls.c @@ -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)