http2: check push header names by length first

Reported-by: Joshua Rogers
Closes #18930
This commit is contained in:
Stefan Eissing 2025-10-08 12:22:22 +02:00 committed by Daniel Stenberg
parent dae19dd94a
commit 93e91e965e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -1590,7 +1590,8 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
if(frame->hd.type == NGHTTP2_PUSH_PROMISE) {
char *h;
if(!strcmp(HTTP_PSEUDO_AUTHORITY, (const char *)name)) {
if((namelen == (sizeof(HTTP_PSEUDO_AUTHORITY)-1)) &&
!strncmp(HTTP_PSEUDO_AUTHORITY, (const char *)name, namelen)) {
/* pseudo headers are lower case */
int rc = 0;
char *check = curl_maprintf("%s:%d", cf->conn->host.name,