From: William Lallemand Date: Thu, 24 Mar 2022 20:59:03 +0000 (+0100) Subject: BUG/MINOR: tools: fix url2sa return value with IPv4 X-Git-Tag: v2.6-dev4~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b938b77ade7b75bff94f810eec78e7e065f04f81;p=thirdparty%2Fhaproxy.git BUG/MINOR: tools: fix url2sa return value with IPv4 Fix 8a91374 ("BUG/MINOR: tools: url2sa reads ipv4 too far") introduced a regression in the value returned when parsing an ipv4 host. Tthe consumed length is supposed to be as far as the first character of the path, only its not computed correctly anymore and return the length minus the size of the scheme. Fixed the issue by reverting 'curr' and 'url' as they were before the patch. Must be backported in every stable branch where the 8a91374 patch was backported. --- diff --git a/src/tools.c b/src/tools.c index f62032b9c1..33cbfc9f6a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1709,9 +1709,7 @@ int url2sa(const char *url, int ulen, struct sockaddr_storage *addr, struct spli out->host_len = ret; } - /* we need to assign again curr and end from the trash */ - url = trash.area; - curr = trash.area + ret; + curr += ret; /* Decode port. */ if (*curr == ':') {