bin/55950: [PATCH] fetch -ds dumps core on ftp URLs

Andre Albsmeier andre.albsmeier at siemens.com
Mon Aug 25 00:40:16 PDT 2003


>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 at 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:


More information about the freebsd-bugs mailing list