Bug#3248: Bug: #1176 /usr/bin/top segfault with unknown terminal
The problem seems to be in the top.c code:
tgetent(NULL, termtype);
cm = tgetstr("cm", 0);
top_clrtobot = tgetstr("cd", 0);
cl = tgetstr("cl", 0);
top_clrtoeol = tgetstr("ce", 0);
ho = tgetstr("ho", 0);
window_size();
There is no error checking after tgetent() to make sure that the termtype
exists.
Also, note:
termtype = getenv("TERM");
if (!termtype) {
/* In theory, $TERM should never not be set, but in practice,
some gettys don't. Fortunately, vt100 is nearly always
correct (or pretty close). */
termtype = "VT100";
/* fprintf(stderr, PROGNAME ": $TERM not set\n"); */
/* exit(1); */
}
VT100 does not exist -- vt100 does.
--
Scott Barker
Linux Consultant
scott@galileo.cuug.ab.ca
http://www.cuug.ab.ca:8001/~barkers/ (under construction)
[ I try to reply to all e-mail within 5 days. If you don't ]
[ get a response by then, I probably didn't get your e-mail ]
[ (we have a sometimes sporadic connection to the internet) ]
"It's better to know some of the questions, than all of the answers."
- James Thurber
Reply to: