Subject: lib/9488: tcsetattr() with invalid termios struct sends SIGHUP to whole process group
To: None <gnats-bugs@gnats.netbsd.org>
From: Sami Lehtinen <sjl@ssh.fi>
List: netbsd-bugs
Date: 02/25/2000 12:15:49
>Number:         9488
>Category:       lib
>Synopsis:       tcsetattr() with invalid termios struct sends SIGHUP to whole process group
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 25 11:15:00 2000
>Last-Modified:
>Originator:     Sami Lehtinen
>Organization:
SSH Communications Security Ltd.
>Release:        1.3.2 <NetBSD-current source date>
>Environment:
	
System: NetBSD johto.ssh.fi 1.3.2 NetBSD 1.3.2 (SSHGEN) #5: Tue Jun 23 19:24:03 EEST 1998 snabb@nurkka.ssh.fi:/usr/src/sys/arch/i386/compile/SSHGEN i386


>Description:
	Try this application: 

	-- killer.c -- cut here --
#include <stdio.h>
#include <termios.h>
#include <string.h>

int main()
{
  struct termios tio;
  memset(&tio, 0, sizeof(tio));
  tcsetattr(fileno(stdin), TCSAFLUSH, &tio);

  return 0;
}
        -- end cut --

Compile with 
% gcc -Wall -g killer.c -o killer -ltermcap

	
>How-To-Repeat:

Just run the above application, and watch your shell die.

	
>Fix:
	
I don't know of a precise fix, but atleast an old FreeBSD survived
with that program.
>Audit-Trail:
>Unformatted: