vtls: alpn setting, check proto parameter

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
This commit is contained in:
Stefan Eissing 2025-09-25 11:15:15 +02:00 committed by Daniel Stenberg
parent ccd2b03b0d
commit cbc30d4ed2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View 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 "