Bug 450 - sftp crashes when trying to upload a file which doesn't exist
Summary: sftp crashes when trying to upload a file which doesn't exist
Status: CLOSED WORKSFORME
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: -current
Hardware: ix86 FreeBSD
: P2 critical
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-04 02:42 AEDT by Andrey Melnikov
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 Andrey Melnikov 2002-12-04 02:42:50 AEDT
sftp> put foo.bar
Segmentation fault (core dumped)

I use FreeBSD 4.6 and OpenSSH 3.4p1 and 3.5p1. 
OpenSSH_3.4p1 FreeBSD-20020702, SSH protocols 1.5/2.0, OpenSSL 0x0090605f

Core dump happens every time I make a mistake in file name used in PUT sftp 
command.
Comment 1 Tim Rice 2002-12-05 15:57:22 AEDT
I can not duplicate this problem on UnixWare or Linux
Comment 2 Markus Friedl 2002-12-05 21:02:06 AEDT
hm, strange, perhaps freebsd glob bug?

% sftp localhost
Connecting to localhost...
sftp> put foo.bar
File "foo.bar" not found.
sftp> quit
% 
Comment 3 Andrey Melnikov 2002-12-06 06:58:58 AEDT
I tried again, but still segmentation fault:

nimnul@217 (~) > sftp localhost
Connecting to localhost...
The authenticity of host 'localhost (127.0.0.1)' can't be established.
DSA key fingerprint is d2:4c:d9:fa:b6:d8:92:20:ec:a4:7f:35:19:15:a9:d6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (DSA) to the list of known hosts.
Password:
sftp> put aaa.bbb
Segmentation fault (core dumped)

I tried it on different FreeBSD machines, with the same result
Comment 4 Ben Lindstrom 2002-12-06 07:51:07 AEDT
Is this compiled by you?  Or are you using ports or FreeBSD in-tree OpenSSH 
version?  I can't find anyone that can mimic this.

- Ben
Comment 5 Damien Miller 2002-12-06 11:05:35 AEDT
Can you get a gdb trace of where it is failing?
Comment 6 Andrey Melnikov 2002-12-07 05:47:33 AEDT
root@217 (~) > gdb -c sftp.core
GNU gdb 4.18 (FreeBSD)
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you ar
welcome to change it and/or distribute copies of it under certain condition
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd".
Core was generated by `sftp'.
Program terminated with signal 11, Segmentation fault.
#0  0x804c7af in ?? ()
(gdb) bt
#0  0x804c7af in ?? ()
#1  0x804cd8c in ?? ()
#2  0x804d72f in ?? ()
#3  0x8049b9a in ?? ()
#4  0x8049505 in ?? ()
(gdb)

Did it help? these are the only things i can do with gdb. What else can I do to 
help? 
Comment 7 Darren Tucker 2002-12-07 10:22:12 AEDT
You need to give it the binary as well as the core to get meaningful results, ie

$ gdb /path/to/sftp sftp.core
(gdb) bt
Comment 8 Andrey Melnikov 2002-12-07 12:58:25 AEDT
The results now are:

root@217 (~) > gdb -c sftp.core /usr/bin/sftp
GNU gdb 4.18 (FreeBSD)
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...(no debugging symbols 
found)...
Core was generated by `sftp'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libssh.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libcrypto.so.2...(no debugging symbols 
found)...done.
Reading symbols from /usr/lib/libc.so.4...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libz.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/libexec/ld-elf.so.1...(no debugging symbols 
found)...done.
#0  0x804c7af in free ()
(gdb) bt
#0  0x804c7af in free ()
#1  0xe in ?? ()
#2  0x804cd8c in free ()
#3  0x804d72f in free ()
#4  0x8049b9a in free ()
#5  0x8049505 in free ()
Comment 9 Andrey Melnikov 2002-12-25 02:43:22 AEDT
> Is this compiled by you?  Or are you using ports or FreeBSD in-tree OpenSSH 
version? I can't find anyone that can mimic this.

I had to upgrade from in-tree OpenSSH to newer OpenSSH. I updated ports using 
cvsup, compiled ssh from ports and deleted files from old one using rm. Did I 
make something wrong?


Comment 10 Damien Miller 2003-01-03 14:48:19 AEDT
FreeBSD glob has had problems in the past - I suspect that is the problem.

I would recommend using the in-tree OpenSSH for FreeBSD. Please report if that
breaks.
Comment 11 Damien Miller 2004-04-14 12:24:18 AEST
Mass change of RESOLVED bugs to CLOSED