From: William Lallemand Date: Wed, 10 Nov 2021 15:57:25 +0000 (+0100) Subject: BUG/MEDIUM: httpclient/cli: free of unallocated hc->req.uri X-Git-Tag: v2.5-dev14~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=67b778418e6335b707c95a773f70318f96ff0664;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: httpclient/cli: free of unallocated hc->req.uri httpclient_new() sets the hc->req.uri ist without duplicating its memory, which is a problem since the string in the ist could be inaccessible at some point. The API was made to use a ist which was allocated dynamically, but httpclient_new() didn't do that, which result in a crash when calling istfree(). This patch fixes the problem by doing an istdup() Fix issue #1452. --- diff --git a/src/http_client.c b/src/http_client.c index fe85f050b8..4e5ef7c1c7 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -535,7 +535,7 @@ struct httpclient *httpclient_new(void *caller, enum http_meth_t meth, struct is goto err; hc->caller = caller; - hc->req.url = url; + hc->req.url = istdup(url); hc->req.meth = meth; return hc;