tty: Avoid a kernel memory discloure via kern.ttys

Four pad bytes at the end of each xtty structure were not being cleared
before being copied out.  Fix this by clearing the whole structure
before populating fields.

MFC after:	3 days
Reported by:	KMSAN
This commit is contained in:
Mark Johnston 2023-12-11 09:19:09 -05:00
parent ce2f34ade8
commit 3c0fb026b2

View file

@ -1288,6 +1288,7 @@ tty_to_xtty(struct tty *tp, struct xtty *xt)
tty_assert_locked(tp);
memset(xt, 0, sizeof(*xt));
xt->xt_size = sizeof(struct xtty);
xt->xt_insize = ttyinq_getsize(&tp->t_inq);
xt->xt_incc = ttyinq_bytescanonicalized(&tp->t_inq);