]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
vtls_cache: bail out proper if Curl_hmacit() fails
authorDaniel Stenberg <daniel@haxx.se>
Sat, 21 Dec 2024 09:54:28 +0000 (10:54 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 21 Dec 2024 11:33:35 +0000 (12:33 +0100)
Pointed out by CodeSonar

Closes #15790

lib/vtls/vtls_scache.c

index 4ba054e3f1075973a52b7190bbabb9b1a82f7d74..a9215223e7c8885e26a1821782cef2ef6ea0e650 100644 (file)
@@ -591,12 +591,14 @@ static CURLcode cf_ssl_find_peer(struct Curl_cfilter *cf,
       unsigned char my_hmac[CURL_SHA256_DIGEST_LENGTH];
       if(!peer_key_len) /* we are lazy */
         peer_key_len = strlen(ssl_peer_key);
-      (void)Curl_hmacit(&Curl_HMAC_SHA256,
-                        scache->peers[i].key_salt,
-                        sizeof(scache->peers[i].key_salt),
-                        (const unsigned char *)ssl_peer_key,
-                        peer_key_len,
-                        my_hmac);
+      result = Curl_hmacit(&Curl_HMAC_SHA256,
+                           scache->peers[i].key_salt,
+                           sizeof(scache->peers[i].key_salt),
+                           (const unsigned char *)ssl_peer_key,
+                           peer_key_len,
+                           my_hmac);
+      if(result)
+        goto out;
       if(!memcmp(scache->peers[i].key_hmac, my_hmac, sizeof(my_hmac))) {
         /* remember peer_key for future lookups */
         scache->peers[i].ssl_peer_key = strdup(ssl_peer_key);