[PATCH] Check tcgetattr return value in init/init.c

Denys Vlasenko vda.linux at googlemail.com
Mon Dec 2 15:36:03 UTC 2019


On Mon, Dec 2, 2019 at 12:22 PM Timur R. Mustafin
<Timur.R.Mustafin at mcst.ru> wrote:
>
> Hello, busybox developers!
>
> I found uninitialized variable use in set_sane_term().
> It calls tcgetattr() function that should set &tty structure, but tcgetattr() can fail.
> During a fail &tty structure stay uninitialized.

Yes.
However.
If tcgetattr() fails, tcsetattr() on the same tty will fail as well.
Thus, uninitialized structure we feed to it won't matter.

> Patch checks return values of tcgetattr(), tcsetattr()

ok,

> and makes set_sane_term() function error-returning.

Do we want that? This means that previously we accepted non-ttys too,
now we will disallow them.


More information about the busybox mailing list