From owner-freebsd-bugs Mon Nov 17 08:10:06 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id IAA21046 for bugs-outgoing; Mon, 17 Nov 1997 08:10:06 -0800 (PST) (envelope-from owner-freebsd-bugs) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id IAA21039; Mon, 17 Nov 1997 08:10:02 -0800 (PST) (envelope-from gnats) Resent-Date: Mon, 17 Nov 1997 08:10:02 -0800 (PST) Resent-Message-Id: <199711171610.IAA21039@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, watanabe@komadori.planet.kobe-u.ac.jp Received: from crayon.planet.kobe-u.ac.jp (crayon.planet.kobe-u.ac.jp [133.30.53.130]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id IAA20360 for ; Mon, 17 Nov 1997 08:00:00 -0800 (PST) (envelope-from watanabe@crayon.planet.kobe-u.ac.jp) Received: (from watanabe@localhost) by crayon.planet.kobe-u.ac.jp (8.8.6/3.5Wpl7-mx) id BAA29855; Tue, 18 Nov 1997 01:00:25 +0900 (JST) Message-Id: <199711171600.BAA29855@crayon.planet.kobe-u.ac.jp> Date: Tue, 18 Nov 1997 01:00:25 +0900 (JST) From: watanabe@komadori.planet.kobe-u.ac.jp Reply-To: watanabe@komadori.planet.kobe-u.ac.jp To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/5072: /usr/bin/fetch parses a URL incorrectly Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 5072 >Category: bin >Synopsis: /usr/bin/fetch parses a URL incorrectly >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Nov 17 08:10:01 PST 1997 >Last-Modified: >Originator: Takeshi WATANABE >Organization: Kobe University, Kobe, Japan >Release: FreeBSD 2.2.2-RELEASE i386 >Environment: I found a bug on 2.2.2-RELEASE and 2.2.5-RELEASE. I don't know on other versions. >Description: According to RFC-1738 and RFC-1808, a HTTP URL has the following format. http://:/? The part cannot contain the colon character (":"), but the part can. Therefore, the following URL is valid. http://www.host.name/foo:bar/file.html "www.host.name" is , and "/foo:bar/file.html" is /. : is omitted; which means ":80". However, /usr/bin/fetch cannot accept this URL. prompt> fetch http://www.host.name/foo:bar/file.html fetch: `http://www.host.name/foo:bar/file.html': invalid port in URL: Undefined error: 0 So, /usr/bin/fetch parses ":bar" to :. This parsing is incorrect. This problem is not so critical, because we avoid this bug to use the following format. prompt> fetch http://www.host.name:80/foo:bar/file.html /usr/bin/fetch can accept this URL. However, it is clear that this is a bug of /usr/bin/fetch. >How-To-Repeat: Always when we use /usr/bin/fetch with a HTTP URL that contains the colon character (":") in the path name. >Fix: Apply the following patch. --- /usr/src/usr.bin/fetch/http.c.orig Mon Mar 10 16:12:51 1997 +++ /usr/src/usr.bin/fetch/http.c Tue Nov 18 00:21:52 1997 @@ -152,7 +152,7 @@ strncat(hostname, p, q - p); p = slash; - if (colon && colon + 1 != slash) { + if (q == colon && colon + 1 != slash) { unsigned long ul; char *ep; >Audit-Trail: >Unformatted: