From owner-freebsd-current@FreeBSD.ORG Wed Jun 4 22:57:29 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 00F8137B401 for ; Wed, 4 Jun 2003 22:57:29 -0700 (PDT) Received: from relay.macomnet.ru (relay.macomnet.ru [195.128.64.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6B55E43F93 for ; Wed, 4 Jun 2003 22:57:27 -0700 (PDT) (envelope-from maxim@macomnet.ru) Received: from news1.macomnet.ru (news1.macomnet.ru [195.128.64.14]) by relay.macomnet.ru (8.11.6/8.11.6) with ESMTP id h555vNA6896332; Thu, 5 Jun 2003 09:57:23 +0400 (MSD) Date: Thu, 5 Jun 2003 09:57:23 +0400 (MSD) From: Maxim Konovalov To: Fred Souza In-Reply-To: <20030604235850.GA2199@torment.storming.org> Message-ID: <20030605095608.A84008@news1.macomnet.ru> References: <20030604170558.GA16091@torment.storming.org> <20030604182145.GA21910@torment.storming.org> <20030604235850.GA2199@torment.storming.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@freebsd.org Subject: Re: FTP client dumping core X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jun 2003 05:57:29 -0000 On Wed, 4 Jun 2003, 20:58-0300, Fred Souza wrote: > > I think what Kris ment was something similiar to > > > > cd /usr/src/usr.bin/ftp > > make clean > > make DEBUG_FLAGS="-g" all install > > Ahh, yes, with that I can see where the problem is. It's because of my > custom prompt, which should look like "ftp user@host:directory> " > > Here's the output of gdb+ftp with the above debug flag: > > > (gdb) run x.y.z.w > Starting program: /usr/bin/ftp x.y.z.w > Connected to x.y.z.w. > 220 h4w h4w h4w > Name (x.y.z.w:fred): ftp > 530 Sorry, no ANONYMOUS access allowed. > ftp: Login failed. > > Program received signal SIGSEGV, Segmentation fault. > 0x0805e346 in formatbuf (buf=0x8069780 "ftp ", len=1024, > src=0x806f110 "ftp %n@%M:%/> ") > at /usr/src/contrib/lukemftp/src/util.c:1400 > 1400 for (p2 = connected ? username : "-"; > *p2 ; p2++) > (gdb) > > > I see now where the problem is, but shouldn't the client handle this > kind of situation better? Try this patch: Index: util.c =================================================================== RCS file: /home/ncvs/src/contrib/lukemftp/src/util.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 util.c --- util.c 15 Jun 2002 09:40:37 -0000 1.1.1.2 +++ util.c 5 Jun 2003 05:55:23 -0000 @@ -1397,7 +1397,8 @@ break; case 'n': - for (p2 = connected ? username : "-"; *p2 ; p2++) + for (p2 = connected && username ? username : "-"; + *p2 ; p2++) ADDBUF(*p2); break; %%% -- Maxim Konovalov, maxim@macomnet.ru, maxim@FreeBSD.org