From quake3@www01.websitefactory.net  Tue Jan 30 15:54:00 2001
Return-Path: <quake3@www01.websitefactory.net>
Received: from www01.websitefactory.net (unknown [204.42.240.60])
	by hub.freebsd.org (Postfix) with ESMTP id 0A36F37B684
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 30 Jan 2001 15:54:00 -0800 (PST)
Received: (from quake3@localhost)
	by www01.websitefactory.net (8.11.1/8.11.1) id f0UNpr149540;
	Tue, 30 Jan 2001 18:51:53 -0500 (EST)
	(envelope-from quake3)
Message-Id: <200101302351.f0UNpr149540@www01.websitefactory.net>
Date: Tue, 30 Jan 2001 18:51:53 -0500 (EST)
From: jweaver@accountsupport.com
Reply-To: jweaver@accountsupport.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: ftp segfault condition 
X-Send-Pr-Version: 3.2

>Number:         24745
>Category:       bin
>Synopsis:       /usr/bin/ftp program segfaults with following commandline
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 30 16:00:01 PST 2001
>Closed-Date:    Wed Jan 31 00:25:06 PST 2001
>Last-Modified:  Wed Jan 31 04:10:04 PST 2001
>Originator:     Jonathan Weaver
>Release:        FreeBSD 4.2-20001205-STABLE i386
>Organization:
HypnoSys Productions
>Environment:
FreeBSD 4.2-20001205-STABLE #0: Tue Dec  5 13:09:07 GMT 2000
    root@usw3.freebsd.org:/usr/src/sys/compile/GENERIC
Timecounter "i8254"  frequency 1193182 Hz
CPU: Pentium III/Pentium III Xeon/Celeron (497.44-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x672  Stepping = 2
  Features=0x387fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,PN,MMX,FXSR,SSE>
real memory  = 268369920 (262080K bytes)

bash-2.04

>Description:
Following http url commandline makes /usr/bin/ftp Segfault



>How-To-Repeat:
bash-2.04$ ftp http://www.wfamaps.com/download.php?file=/pub/wfamaps/maps/map-2forts-wfa.zip
Requesting http://www.wfamaps.com/download.php?file=/pub/wfamaps/maps/map-2forts-wfa.zip
ftp: Error retrieving file: 404 Not Found

ftp in free(): warning: junk pointer, too high to make sense.
Segmentation fault (core dumped)


>Fix:
Have no time to debug the code, sorry. =(



>Release-Note:
>Audit-Trail:

From: Alex Kapranoff <kapr@acm.org>
To: jweaver@accountsupport.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/24745: ftp segfault condition
Date: Wed, 31 Jan 2001 09:46:11 +0300

 On Tue, Jan 30, 2001 at 06:51:53PM -0500, jweaver@accountsupport.com wrote:
 
 > >Description:
 > Following http url commandline makes /usr/bin/ftp Segfault
 > 
 > >How-To-Repeat:
 > bash-2.04$ ftp http://www.wfamaps.com/download.php?file=/pub/wfamaps/maps/map-2forts-wfa.zip
 > Requesting http://www.wfamaps.com/download.php?file=/pub/wfamaps/maps/map-2forts-wfa.zip
 > ftp: Error retrieving file: 404 Not Found
 > 
 > ftp in free(): warning: junk pointer, too high to make sense.
 > Segmentation fault (core dumped)
 
   I confirm the bug under 4.2-STABLE. By the way, it works fine under
 -CURRENT, so you can try to backport some -CURRENT diffs.
 
 -- 
 Alex Kapranoff,                              Voice: +7(0832)791845
 We've lived 4 weeks in the brand new millenium...
 

From: Peter Pentchev <roam@orbitel.bg>
To: Alex Kapranoff <kapr@acm.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/24745: ftp segfault condition
Date: Wed, 31 Jan 2001 09:25:35 +0200

 On Tue, Jan 30, 2001 at 11:00:08PM -0800, Alex Kapranoff wrote:
 > The following reply was made to PR bin/24745; it has been noted by GNATS.
 > 
 > From: Alex Kapranoff <kapr@acm.org>
 > To: jweaver@accountsupport.com
 > Cc: FreeBSD-gnats-submit@FreeBSD.ORG
 > Subject: Re: bin/24745: ftp segfault condition
 > Date: Wed, 31 Jan 2001 09:46:11 +0300
 > 
 >  On Tue, Jan 30, 2001 at 06:51:53PM -0500, jweaver@accountsupport.com wrote:
 >  
 >  > >Description:
 >  > Following http url commandline makes /usr/bin/ftp Segfault
 >  > 
 >  > >How-To-Repeat:
 >  > bash-2.04$ ftp http://www.wfamaps.com/download.php?file=/pub/wfamaps/maps/map-2forts-wfa.zip
 >  > Requesting http://www.wfamaps.com/download.php?file=/pub/wfamaps/maps/map-2forts-wfa.zip
 >  > ftp: Error retrieving file: 404 Not Found
 >  > 
 >  > ftp in free(): warning: junk pointer, too high to make sense.
 >  > Segmentation fault (core dumped)
 >  
 >    I confirm the bug under 4.2-STABLE. By the way, it works fine under
 >  -CURRENT, so you can try to backport some -CURRENT diffs.
 
 Actually, this is pretty much the only difference between usr.bin/ftp/
 in -stable and -current.  Try the attached patch, it does the trick
 for me.
 
 G'luck,
 Peter
 
 -- 
 because I didn't think of a good beginning of it.
 
 Index: src/usr.bin/ftp/fetch.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/ftp/fetch.c,v
 retrieving revision 1.12.2.2
 diff -u -r1.12.2.2 fetch.c
 --- src/usr.bin/ftp/fetch.c	2000/06/24 15:35:46	1.12.2.2
 +++ src/usr.bin/ftp/fetch.c	2001/01/31 07:24:16
 @@ -270,6 +270,7 @@
  	break;
        }
  	freeaddrinfo(res0);
 +	res0 = NULL;
  
  	/*
  	 * Construct and send the request.  We're expecting a return
 
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Wed Jan 31 00:25:06 PST 2001 
State-Changed-Why:  
Duplicate of PR bin/21476 (the latter was fixed). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24745 

From: Dag-Erling Smorgrav <des@ofug.org>
To: jweaver@accountsupport.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/24745: ftp segfault condition
Date: 31 Jan 2001 13:09:34 +0100

 jweaver@accountsupport.com writes:
 > Following http url commandline makes /usr/bin/ftp Segfault
 
 Don't use ftp(1) for retrieving HTTP documents. It only pretends to
 work. Use fetch(1), which makes a pretty good attempt at really
 working.
 
 DES
 -- 
 Dag-Erling Smorgrav - des@ofug.org
 
>Unformatted:
