NetBSD Problem Report #51558

From ast@styx.ch  Sun Oct 16 23:14:27 2016
Return-Path: <ast@styx.ch>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 66E3A7A221
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 16 Oct 2016 23:14:27 +0000 (UTC)
Message-Id: <20161016214204.CE6FB12D4CD@x2.styx.ch>
Date: Sun, 16 Oct 2016 23:42:04 +0200 (CEST)
From: ast@NetBSD.org
Reply-To: ast@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: ftp dumps core after usage message when IPv6 URL lacks a slash
X-Send-Pr-Version: 3.95

>Number:         51558
>Category:       bin
>Synopsis:       ftp dumps core after usage message when IPv6 URL lacks a slash
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 16 23:15:00 +0000 2016
>Closed-Date:    Wed Nov 02 02:30:46 +0000 2016
>Last-Modified:  Wed Nov 16 18:00:01 +0000 2016
>Originator:     box ast@NetBSD.org
>Release:        NetBSD 7.99.25 and 7.0
>Organization:
>Environment:
System: NetBSD box 7.0_STABLE NetBSD 7.0_STABLE (GENERIC) #6: Tue Jul 26 17:35:33 CEST 2016 ast@x2.styx.ch:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	ftp dumps core after 'Invalid address' message
	ftp 'http://[2a00:1450:400a:807::1005]#q=a'
	ftp: Invalid address `[2a00:1450:400a:807::1005]#q=a' in URL `http://[2a00:1450:400a:807::1005]#q=a'
	zsh: segmentation fault (core dumped)  ftp 'http://[2a00:1450:400a:807::1005]#q=a'

>How-To-Repeat:
	ftp 'http://[2a00:1450:400a:807::1005]#q=a'

>Fix:
	Add the trailing slash after the IPv6:
	ftp 'http://[2a00:1450:400a:807::1005]/#q=a'
	Requesting http://[2a00:1450:400a:807::1005]/#q=a
	ftp: Error retrieving file `404 Not Found'

But here's a patch which actually fixes the problem:

Index: usr.bin/ftp/fetch.c
===================================================================
RCS file: /cvsroot/src/usr.bin/ftp/fetch.c,v
retrieving revision 1.224
diff -u -r1.224 fetch.c
--- usr.bin/ftp/fetch.c	3 Aug 2016 12:33:56 -0000	1.224
+++ usr.bin/ftp/fetch.c	16 Oct 2016 21:30:29 -0000
@@ -1296,6 +1296,7 @@
 	rval = 1;

 	initurlinfo(&ui);
+	initurlinfo(&oui);
 	initauthinfo(&wauth, wwwauth);
 	initauthinfo(&pauth, proxyauth);



>Release-Note:

>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51558: ftp dumps core after usage message when IPv6 URL
 lacks a slash
Date: Mon, 17 Oct 2016 00:46:23 +0000

 On Sun, Oct 16, 2016 at 11:15:00PM +0000, ast@NetBSD.org wrote:
  > But here's a patch which actually fixes the problem:

 Any reason not to just commit that? 

 -- 
 David A. Holland
 dholland@netbsd.org

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51558 CVS commit: src/usr.bin/ftp
Date: Sun, 16 Oct 2016 20:52:54 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Mon Oct 17 00:52:53 UTC 2016

 Modified Files:
 	src/usr.bin/ftp: fetch.c

 Log Message:
 PR/51558: ast@: ftp dumps core after usage message when IPv6 URL lacks a slash.
 Initialize variable so that we don't get random behavior on cleanup.


 To generate a diff of this commit:
 cvs rdiff -u -r1.224 -r1.225 src/usr.bin/ftp/fetch.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->pending-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 17 Oct 2016 01:20:47 +0000
State-Changed-Why:
pullup-7 #1265


From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51558 CVS commit: [netbsd-7] src/usr.bin/ftp
Date: Tue, 1 Nov 2016 19:30:44 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Tue Nov  1 19:30:44 UTC 2016

 Modified Files:
 	src/usr.bin/ftp [netbsd-7]: fetch.c

 Log Message:
 Pull up following revision(s) (requested by dholland in ticket #1265):
 	usr.bin/ftp/fetch.c: revision 1.225
 PR/51558: ast@: ftp dumps core after usage message when IPv6 URL lacks a slash.
 Initialize variable so that we don't get random behavior on cleanup.


 To generate a diff of this commit:
 cvs rdiff -u -r1.205.4.4 -r1.205.4.5 src/usr.bin/ftp/fetch.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 02 Nov 2016 02:30:46 +0000
State-Changed-Why:
pulled up


From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51558 CVS commit: [netbsd-6] src/usr.bin/ftp
Date: Wed, 16 Nov 2016 17:56:42 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Wed Nov 16 17:56:42 UTC 2016

 Modified Files:
 	src/usr.bin/ftp [netbsd-6]: fetch.c

 Log Message:
 Pull up following revision(s) (requested by nonaka in ticket #1414):
 	usr.bin/ftp/fetch.c: revision 1.225
 PR/51558: ast@: ftp dumps core after usage message when IPv6 URL lacks a slash.
 Initialize variable so that we don't get random behavior on cleanup.


 To generate a diff of this commit:
 cvs rdiff -u -r1.195.2.3 -r1.195.2.4 src/usr.bin/ftp/fetch.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.