#71 uninitialized var in scsh/tty1.c

closed-fixed
run-time (53)
5
2002-07-04
2002-07-04
Anonymous
No

In scheme_tcsetattr, what I understand of the following
code:
struct termios t;

memcpy(t.c_cc, control_chars, NCCS);

/* This first clause of this conditional test will
hopefully
** resolve the branch at compile time. However, since
VMIN/VEOF
** and VTIME/VEOL are allowed by POSIX to colllide,
we have to check.
** If they do collide, we set EOF & EOL in canonical
mode, and MIN & TIME
** in raw mode. Ah, Unix.
*/

if( (VMIN != VEOF && VTIME != VEOL) || !(t.c_lflag &
ICANON) ) {
t.c_cc[VMIN] = min;
t.c_cc[VTIME] = time;
}

t.c_iflag = (iflag_hi8 << 24) | iflag_lo24;
t.c_oflag = (oflag_hi8 << 24) | oflag_lo24;
t.c_cflag = (cflag_hi8 << 24) | cflag_lo24;
t.c_lflag = (lflag_hi8 << 24) | lflag_lo24;

is that the test !(t.c_lflag & ICANON) is pretty much
undefined, because t.c_lflag is not yet initialized.

Discussion

    • assigned_to: nobody --> mainzelm
    • status: open --> closed-out-of-date
     
  • Logged In: YES
    user_id=17553

    The quoted code if part of the obsolete 0.5.X series.

     
  • Logged In: YES
    user_id=17553

    Ah, sorry, the 0.6 code has the same problem. I've solved it
    by moving the initialization of t.c_lflag above the test.

     
    • status: closed-out-of-date --> closed-fixed