Bug 73 - sftp segfaults on an attempt to up/download a nonexistent file
Summary: sftp segfaults on an attempt to up/download a nonexistent file
Status: CLOSED WORKSFORME
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: -current
Hardware: ix86 FreeBSD
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL: http://www.FreeBSD.org/cgi/query-pr.c...
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-18 21:15 AEDT by Peter Pentchev
Modified: 2004-04-14 12:24 AEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Pentchev 2002-01-18 21:15:12 AEDT
When the name of a non-existent file is given as the argument
to a 'get' or 'put' command, sftp(1) fails to interpret correctly
the result of the glob(3) invocation.  glob(3) does not return
an error (a non-zero exit), yet it does not return any meaningful
file names, either, so process_get() and process_put()'s attempts
to access the gl_pathv[] array fail miserably.

A trivial patch is posted in the audit-trail of the FreeBSD
problem report referenced by the URL above.
Comment 1 Damien Miller 2002-01-19 09:38:07 AEDT
Are you sure it is not your glob() implementation that is incorrect here? sftp
relies on glob to return non-zero (i.e. GLOB_NOMATCH) when no files are matched.
This works correctly on Linux, Solaris and OpenBSD.
Comment 2 Damien Miller 2002-01-23 17:25:00 AEDT
Resolution: FreeBSD's glob function doesn't support GLOB_NOMATCH (which AFAIK is
a POSIX requirement). FreeBSD will patch their shipped version of sftp for the
upcoming release and will implement GLOB_NOMATCH in future.

The URL attached to this bug includes the patch they intend to apply (it also
contains a GLOB_NOMATCH patch)
Comment 3 Damien Miller 2004-04-14 12:24:17 AEST
Mass change of RESOLVED bugs to CLOSED