From nobody@FreeBSD.org  Tue Feb 20 21:35:04 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 9D70837B401
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 20 Feb 2001 21:35:01 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id f1L5Z1M71942;
	Tue, 20 Feb 2001 21:35:01 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200102210535.f1L5Z1M71942@freefall.freebsd.org>
Date: Tue, 20 Feb 2001 21:35:01 -0800 (PST)
From: fumis@bigfoot.com
To: freebsd-gnats-submit@FreeBSD.org
Subject: ftp crashes in remotemodtime ().
X-Send-Pr-Version: www-1.0

>Number:         25243
>Category:       bin
>Synopsis:       ftp crashes in remotemodtime ().
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 20 21:40:01 PST 2001
>Closed-Date:    Fri Apr 6 04:38:11 PDT 2001
>Last-Modified:  Fri Apr 06 04:39:45 PDT 2001
>Originator:     SHIMIZU Fumiyuki
>Release:        4.2-STABLE
>Organization:
>Environment:
FreeBSD ***snip*** 4.2-STABLE FreeBSD 4.2-STABLE #1: Tue Feb 20 14:01:10 JST 2001 ***snip***
>Description:
/usr/bin/ftp crashes after getting a file.

ftp> get foobar
local: foobar remote: foobar
227 Entering Passive Mode (***snip***)
150 Opening data connection for foobar (696075740 bytes).
100% |**************************************************|   663 MB    00:00 ETA
226 Transfer complete.
696075740 bytes received in 11999.42 seconds (56.65 KB/s)
Segmentation fault - core dumped

>How-To-Repeat:
Connect to ftpd which answers with less than 14 or more than 15 characters against `MDTM' request, and get some files.

>Fix:
Braces required just after `if (fmt != NULL)' in remotemodtime ().
/usr/src/usr.bin/ftp/util.c, line 533

>Release-Note:
>Audit-Trail:

From: Peter Pentchev <roam@orbitel.bg>
To: fumis@bigfoot.com
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/25243: ftp crashes in remotemodtime ().
Date: Wed, 21 Feb 2001 08:55:45 +0200

 On Tue, Feb 20, 2001 at 09:35:01PM -0800, fumis@bigfoot.com wrote:
 > 
 > >Number:         25243
 > >Category:       bin
 > >Synopsis:       ftp crashes in remotemodtime ().
 > >Originator:     SHIMIZU Fumiyuki
 > >Release:        4.2-STABLE
 > >Organization:
 > >Environment:
 > FreeBSD ***snip*** 4.2-STABLE FreeBSD 4.2-STABLE #1: Tue Feb 20 14:01:10 JST 2001 ***snip***
 > >Description:
 > /usr/bin/ftp crashes after getting a file.
 > 
 > ftp> get foobar
 > local: foobar remote: foobar
 > 227 Entering Passive Mode (***snip***)
 > 150 Opening data connection for foobar (696075740 bytes).
 > 100% |**************************************************|   663 MB    00:00 ETA
 > 226 Transfer complete.
 > 696075740 bytes received in 11999.42 seconds (56.65 KB/s)
 > Segmentation fault - core dumped
 > 
 > >How-To-Repeat:
 > Connect to ftpd which answers with less than 14 or more than 15 characters against `MDTM' request, and get some files.
 > 
 > >Fix:
 > Braces required just after `if (fmt != NULL)' in remotemodtime ().
 > /usr/src/usr.bin/ftp/util.c, line 533
 
 And the patch itself (trivial, yet needed indeed)..
 
 G'luck,
 Peter
 
 -- 
 "yields falsehood, when appended to its quotation." yields falsehood, when appended to its quotation.
 
 Index: src/usr.bin/ftp/util.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/ftp/util.c,v
 retrieving revision 1.13
 diff -u -r1.13 util.c
 --- src/usr.bin/ftp/util.c	2000/05/22 17:18:38	1.13
 +++ src/usr.bin/ftp/util.c	2001/02/21 06:52:52
 @@ -529,7 +529,7 @@
  				y2kbug = 1;
  			} else if (len == 14)
  				fmt = "%04d%02d%02d%02d%02d%02d";
 -			if (fmt != NULL)
 +			if (fmt != NULL) {
  				memset(&timebuf, 0, sizeof(timebuf));
  				if (sscanf(mtbuf, fmt, &year, &month,
  				    &timebuf.tm_mday, &timebuf.tm_hour,
 @@ -542,6 +542,7 @@
  						timebuf.tm_year = year - 1900;
  					rtime = mktime(&timebuf);
  				}
 +			}
  		}
  		if (rtime == -1 && (noisy || debug != 0))
  			printf("Can't convert %s to a time.\n", mtbuf);
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Fri Apr 6 04:38:11 PDT 2001 
State-Changed-Why:  
Fixed in: 
rev.1.14 (-current) 
rev.1.12.2.2 (RELENG_4) 
rev.1.6.2.3 (RELENG_3) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25243 
>Unformatted:
