[bug #68296] maybe_prepend_scheme: strchr finds colons in path component
sdainard <[email protected]> Wed, 29 Apr 2026 14:37:40 -0400 (EDT)
| Newsgroups | gmane.comp.web.wget.general |
|---|---|
| Message-ID | <[email protected]> |
--8323329-1714636915-1777487860=:3575840
Content-Type: TEXT/plain; CHARSET=utf-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
Content-Disposition: inline
URL:=0A <https://savannah.gnu.org/bugs/?68296>=0A=0A Summa=
ry: maybe_prepend_scheme: strchr finds colons in path=0Acomponent=0A =
Group: GNU Wget=0A Submitter: sdainard=0A =
Submitted: Wed 29 Apr 2026 06:37:37 PM UTC=0A Catego=
ry: None=0A Severity: 3 - Normal=0A Priority:=
5 - Normal=0A Status: None=0A Privacy: Pu=
blic=0A Assigned to: None=0A Originator Name: Samuel Da=
inard=0A Originator Email:=0A Open/Closed: Open=0A =
Discussion Lock: Unlocked=0A Release: trunk=0A Op=
erating System: None=0A Reproducibility: None=0A Fixed Re=
lease: None=0A Planned Release: None=0A Regression: No=
ne=0A Work Required: None=0A Patch Included: Yes=0A=0A=
=0A _______________________________________________________=0A=0AFollow-=
up Comments:=0A=0A=0A------------------------------------------------------=
-=0ADate: Wed 29 Apr 2026 06:37:37 PM UTC By: sdainard <sdainard>=0Amaybe_p=
repend_scheme() (commit c419542d) uses strchr(url, ':') which finds the=0Af=
irst colon anywhere in the URL, including the path.=0A =
=0A=0A =
=0A A schemeless URL like "www.example.com/path:name" ca=
uses strchr to find the=0Acolon in "path:name". is_valid_port("name") retur=
ns false, so the function=0Areturns NULL and refuses to prepend "http://".=
=0A =0A=0A =
=0A The previous strpbrk(url, "=
:/") avoided this by stopping at whichever of ':'=0Aor '/' came first. Addi=
ng a slash check restores that behavior without=0Areintroducing the removed=
shorthand URL support.=0A =
=0A=0A =
=0A Related: bug #68295 (is_valid_port atoi fix)=0A =
=0A=0A =
=0A Patch attached=0A=0A=0A=0A=0A=0A=0A ___=
____________________________________________________=0AFile Attachments:=0A=
=0AName: Limit-colon-search-to-authority-in-maybe_prepend_scheme.patch Size=
:=0A1.2KiB=0A=0A<https://file.savannah.gnu.org/file/Limit-colon-search-to-a=
uthority-in-maybe_prepend_scheme.patch?file_id=3D58527>=0A=0A=0A=0A AGPL=
NOTICE=0A=0AThese attachments are served by Savane. You can download the c=
orresponding=0Asource code of Savane at=0Ahttps://savannah.gnu.org/source/s=
avane-c36938be85ff6c1b727bc7dd7fd30e48f9142870.tar.gz=0A=0A ____________=
___________________________________________=0A=0AReply to this item at:=0A=
=0A <https://savannah.gnu.org/bugs/?68296>=0A=0A__________________________=
_____________________=0AMessage sent via Savannah=0Ahttps://savannah.gnu.or=
g/=0A
--8323329-1714636915-1777487860=:3575840
Content-Type: APPLICATION/pgp-signature; name=signature.asc
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCafJP9AAKCRCqLAuaBUf3
Tq+fAP9mq/Sor1r2UJ/U6nh0Zo7PlfNDNRguShIPqLiBJAyZowD/YS8mgBE+g8xq
XdM1Ha3FfETDywSSN+w/C6MALOWxDwo=
=OkiQ
-----END PGP SIGNATURE-----
--8323329-1714636915-1777487860=:3575840--