Date: Mon, 25 Aug 2003 09:39:10 +0200 (CEST) From: Andre Albsmeier <andre.albsmeier@siemens.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/55950: [PATCH] fetch -ds dumps core on ftp URLs Message-ID: <200308250739.h7P7dASD003261@curry.mchp.siemens.de> Resent-Message-ID: <200308250740.h7P7eFc4099893@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 55950 >Category: bin >Synopsis: [PATCH] fetch -ds dumps core on ftp URLs >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 25 00:40:14 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Andre Albsmeier >Release: FreeBSD 4.8-STABLE i386 >Organization: >Environment: System: FreeBSD 4.8-STABLE #0: Tue Aug 12 09:17:59 CEST 2003 >Description: fetch does a coredump when getting invoked with -ds on ftp URLs. The bug was introduced with 1.16.2.31 of ftp.c. >How-To-Repeat: andre@gate:~>fetch -ds ftp://ftp.freebsd.org/pub/FreeBSD/README.TXT zsh: 13731 segmentation fault (core dumped) fetch -ds ftp://ftp.freebsd.org/pub/FreeBSD/README.TXT >Fix: in lib/libfetch/ftp.c we have: /* just a stat */ if (strcmp(op, "STAT") == 0) return (FILE *)1; /* bogus return value */ if (strcmp(op, "STOR") == 0 || strcmp(op, "APPE") == 0) so the fix is: --- lib/libfetch/ftp.c.ORI Tue Jun 10 08:54:16 2003 +++ lib/libfetch/ftp.c Mon Aug 25 08:15:06 2003 @@ -1006,7 +1006,7 @@ f = _ftp_request(url, "STAT", us, _ftp_get_proxy(flags), flags); if (f == NULL) return (-1); - fclose(f); + /* no need to close the file since the pointer is bogus anyway */ return (0); } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200308250739.h7P7dASD003261>