]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
vtls: alpn setting, check proto parameter
authorStefan Eissing <stefan@eissing.org>
Thu, 25 Sep 2025 09:15:15 +0000 (11:15 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 25 Sep 2025 12:04:14 +0000 (14:04 +0200)
When setting the negotiated alpn protocol, either then length
must be 0 or a pointer must be passed.

Reported in Joshua's sarif data

Closes #18717

lib/vtls/vtls.c

index bfec585ce21051e60ab250fe54350c0708e196c1..9872e4c24d426dfbeef2211497dbdfe8bff04e43 100644 (file)
@@ -1993,6 +1993,11 @@ CURLcode Curl_alpn_set_negotiated(struct Curl_cfilter *cf,
       result = CURLE_SSL_CONNECT_ERROR;
       goto out;
     }
+    else if(!proto) {
+      DEBUGASSERT(0); /* with length, we need a pointer */
+      result = CURLE_SSL_CONNECT_ERROR;
+      goto out;
+    }
     else if((strlen(connssl->negotiated.alpn) != proto_len) ||
             memcmp(connssl->negotiated.alpn, proto, proto_len)) {
       failf(data, "ALPN: asked for '%s' from previous session, but server "