Article View: comp.bugs.4bsd
Article #468"init" doesn't check for null pointers
From: Guy Harris
Date: Wed, 14 Jan 1987 12:43
Date: Wed, 14 Jan 1987 12:43
88 lines
2760 bytes
2760 bytes
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 ----
Technical Details
Message-ID:
<11393@sun.uucp>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!decwrl!sun!gorodish!guyShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!decwrl!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.bugs.4bsd Subject: "init" doesn't check for null pointers Message-ID: <11393@sun.uucp> Date: Wed, 14-Jan-87 07:43:55 EST Article-I.D.: sun.11393 Posted: Wed Jan 14 07:43:55 1987 Date-Received: Thu, 15-Jan-87 03:26:46 EST Sender: news@sun.uucp Lines: 88