Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
SUSE:SLE-15-SP2:Update
curl-mini
curl-CVE-2024-2398.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File curl-CVE-2024-2398.patch of Package curl-mini
From deca8039991886a559b67bcd6701db800a5cf764 Mon Sep 17 00:00:00 2001 From: Stefan Eissing <stefan@eissing.org> Date: Wed, 6 Mar 2024 09:36:08 +0100 Subject: [PATCH] http2: push headers better cleanup - provide common cleanup method for push headers Closes #13054 --- lib/http2.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) Index: curl-7.66.0/lib/http2.c =================================================================== --- curl-7.66.0.orig/lib/http2.c +++ curl-7.66.0/lib/http2.c @@ -516,6 +516,14 @@ static struct Curl_easy *duphandle(struc return second; } +static void free_push_headers(struct HTTP *stream) +{ + size_t i; + for(i = 0; i<stream->push_headers_used; i++) + free(stream->push_headers[i]); + Curl_safefree(stream->push_headers); + stream->push_headers_used = 0; +} static int push_promise(struct Curl_easy *data, struct connectdata *conn, @@ -530,7 +538,6 @@ static int push_promise(struct Curl_easy struct curl_pushheaders heads; CURLMcode rc; struct http_conn *httpc; - size_t i; /* clone the parent */ struct Curl_easy *newhandle = duphandle(data); if(!newhandle) { @@ -559,11 +566,7 @@ static int push_promise(struct Curl_easy Curl_set_in_callback(data, false); /* free the headers again */ - for(i = 0; i<stream->push_headers_used; i++) - free(stream->push_headers[i]); - free(stream->push_headers); - stream->push_headers = NULL; - stream->push_headers_used = 0; + free_push_headers(stream); if(rv) { /* denied, kill off the new handle again */ @@ -993,11 +999,17 @@ static int on_header(nghttp2_session *se else if(stream->push_headers_used == stream->push_headers_alloc) { char **headp; + if(stream->push_headers_alloc > 1000) { + /* this is beyond crazy many headers, bail out */ + failf(data_s, "Too many PUSH_PROMISE headers"); + free_push_headers(stream); + return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; + } stream->push_headers_alloc *= 2; - headp = Curl_saferealloc(stream->push_headers, - stream->push_headers_alloc * sizeof(char *)); + headp = realloc(stream->push_headers, + stream->push_headers_alloc * sizeof(char *)); if(!headp) { - stream->push_headers = NULL; + free_push_headers(stream); return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; } stream->push_headers = headp;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor