"init" doesn't check for null pointers

Guy Harris guy%gorodish at Sun.COM
Wed Jan 14 22:43:55 AEST 1987


Index:	etc/init.c 4.3BSD

Description:
	When looking at the "ty_window" entry for a "ttyent" structure,
	"init" doesn't bother checking that "ty_window" is non-NULL.
	This may either cause core dumps or may cause it to erroneously
	conclude that a given entry has a window system program.
Repeat-By:
	Try running "init" on a machine where a NULL pointer, when treated
	as a character pointer and dereferenced, doesn't yield a null
	string.  Then try doing "kill -HUP 1"; it will get confused.
Fix:
Also includes a couple of other minor fixes.

*** /arch/4.3/usr/src/etc/init.c	Mon May 26 22:12:44 1986
--- init.c	Wed Jan 14 04:39:06 1987
***************
*** 144,150 ****
  	shutend();
  }
  
! char shutfailm[] = "WARNING: Something is hung (wont die); ps axl advised\n";
  
  shutreset()
  {
--- 144,150 ----
  	shutend();
  }
  
! char shutfailm[] = "WARNING: Something is hung (won't die); ps axl advised\n";
  
  shutreset()
  {
***************
*** 198,203 ****
--- 198,204 ----
  			dup2(0, 1);
  			dup2(0, 2);
  			execl(shell, minus, (char *)0);
+ 			perror(shell);
  			exit(0);
  		}
  		while ((xpid = wait((int *)0)) != pid)
***************
*** 306,312 ****
  				p->xflag |= CHANGE;
  				SCPYN(p->comn, t->ty_getty);
  			}
! 			if (SCMPN(p->wcmd, t->ty_window)) {
  				p->xflag |= WCHANGE|CHANGE;
  				SCPYN(p->wcmd, t->ty_window);
  			}
--- 307,313 ----
  				p->xflag |= CHANGE;
  				SCPYN(p->comn, t->ty_getty);
  			}
! 			if (SCMPN(p->wcmd, t->ty_window ? t->ty_window : "")) {
  				p->xflag |= WCHANGE|CHANGE;
  				SCPYN(p->wcmd, t->ty_window);
  			}
***************
*** 335,341 ****
  		SCPYN(p->line, t->ty_name);
  		p->xflag |= FOUND|CHANGE;
  		SCPYN(p->comn, t->ty_getty);
! 		if (strcmp(t->ty_window, "") != 0) {
  			p->xflag |= WCHANGE;
  			SCPYN(p->wcmd, t->ty_window);
  		}
--- 336,342 ----
  		SCPYN(p->line, t->ty_name);
  		p->xflag |= FOUND|CHANGE;
  		SCPYN(p->comn, t->ty_getty);
! 		if (t->ty_window && strcmp(t->ty_window, "") != 0) {
  			p->xflag |= WCHANGE;
  			SCPYN(p->wcmd, t->ty_window);
  		}
***************
*** 382,389 ****
  	if (p->wpid > 0)
  		kill(p->wpid, SIGHUP);
  }
- 
- #include <sys/ioctl.h>
  
  dfork(p)
  	struct tab *p;
--- 383,388 ----



More information about the Comp.bugs.4bsd.ucb-fixes mailing list