From archie@whistle.com  Thu Jul 24 13:26:35 1997
Received: from whistle.com (s205m131.whistle.com [207.76.205.131])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id NAA22042
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Jul 1997 13:26:34 -0700 (PDT)
Received: (from smap@localhost) by whistle.com (8.7.5/8.6.12) id NAA01169 for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Jul 1997 13:25:56 -0700 (PDT)
Received: from bubba.whistle.com(207.76.205.7) by whistle.com via smap (V1.3)
	id sma001165; Thu Jul 24 13:25:26 1997
Received: (from archie@localhost) by bubba.whistle.com (8.8.5/8.6.12) id NAA07529; Thu, 24 Jul 1997 13:25:25 -0700 (PDT)
Message-Id: <199707242025.NAA07529@bubba.whistle.com>
Date: Thu, 24 Jul 1997 13:25:25 -0700 (PDT)
From: archie@whistle.com
Reply-To: archie@whistle.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: ftp core dump
X-Send-Pr-Version: 3.2

>Number:         4163
>Category:       bin
>Synopsis:       ftp core dumps after hitting control-C
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    archie
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 24 13:30:01 PDT 1997
>Closed-Date:    Mon Jul 5 13:07:30 PDT 1999
>Last-Modified:  Mon Jul  5 13:08:09 PDT 1999
>Originator:     Archie Cobbs
>Release:        FreeBSD 2.2-STABLE i386
>Organization:
Whistle Communications, Inc.
>Environment:

	FreeBSD 2.2 branch as of approx. July 20, 1997

>Description:

  Did a file transfer, enabling hash marks first. Seemed to finish
  (no more data was being sent and remote had closed the connection)
  but my local side didn't return a prompt. I hit control-C and got
  a core dump:


###########
^C
receive aborted
waiting for remote to finish abort
ftp: abort: Broken pipe
Segmentation fault (core dumped)

Here's why -- variable "cout" is NULL:

  Core was generated by `ftp'.
  Program terminated with signal 11, Segmentation fault.
  #0  0x806d01a in ?? ()
  (gdb) where
  #0  0x806d01a in ?? ()
  #1  0x8080060 in ?? ()
  #2  0x806cbaf in ?? ()
  #3  0x8e58 in abort_remote (din=0x809054c) at ftp.c:1513
  #4  0x7bf0 in recvrequest (cmd=0x2596 "", local=0x16050 "", remote=0x13f2c "", 
      lmode=0x2507 "", printnames=1) at ftp.c:978
  #5  0x2953 in getit (argc=3, argv=0x14430, restartit=0, mode=0x2507 "")
      at cmds.c:686
  #6  0x253b in get (argc=3, argv=0x14430) at cmds.c:579
  #7  0x9608 in cmdscanner (top=1) at main.c:289
  #8  0x934a in main (argc=1, argv=0xefbfd8e4) at main.c:177
  (gdb) up 4
  #4  0x7bf0 in recvrequest (cmd=0x2596 "", local=0x16050 "", remote=0x13f2c "", 
      lmode=0x2507 "", printnames=1) at ftp.c:978
  ftp.c:978: No such file or directory.
  (gdb) down
  #3  0x8e58 in abort_remote (din=0x809054c) at ftp.c:1513
  ftp.c:1513: No such file or directory.
  (gdb) p cout
  $1 = (FILE *) 0x0

Relevant source code snippet from ftp.c:

  1498 void
  1499 abort_remote(din)
  1500         FILE *din;
  1501 {
  1502         char buf[BUFSIZ];
  1503         int nfnd;
  1504         struct fd_set mask;
  1505
  1506         /*
  1507          * send IAC in urgent mode instead of DM because 4.3BSD places o
  ob mark  
  1508          * after urgent byte rather than before as is protocol now
  1509          */
  1510         sprintf(buf, "%c%c%c", IAC, IP, IAC);
  1511         if (send(fileno(cout), buf, 3, MSG_OOB) != 3)
  1512                 warn("abort"); 
  1513         fprintf(cout,"%cABOR\r\n", DM);	<--- core dump here
  1514         (void) fflush(cout);
  1515         FD_ZERO(&mask);
  1516         FD_SET(fileno(cin), &mask);
  1517         if (din) {
  1518                 FD_SET(fileno(din), &mask);
  1519         } 

>How-To-Repeat:

  Do what I described, I guess...

>Fix:

  Dunno.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->archie 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Mar 29 17:35:07 PST 1999 
Responsible-Changed-Why:  
Originator is now a committer. :-) 
State-Changed-From-To: open->closed 
State-Changed-By: archie 
State-Changed-When: Mon Jul 5 13:07:30 PDT 1999 
State-Changed-Why:  
I can't reproduce the problem anymore... 
>Unformatted:
