Subject: Bug#1176: usr/bin/top segfault with unknown terminal

From: Scott Barker <[email-masked]>
Date: Fri, 7 Jun 1996 11:55:41 -0600 (MDT)

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
[email-masked]
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) ]

"A man's ethical behavior should be based effectually on sympathy, education,
   and social ties; no religious basis is necessary.  Man would indeed be in a
   poor way if he had to be restrained by fear and punshiment and hope of
   reward after death."
   - Albert Einstein