Re: Bug#1098694: Crash in agetty due to invalid strncmp call in Trixie
Karel Zak <[email protected]>
| Newsgroups | org.kernel.vger.util-linux |
|---|---|
| Message-ID | <2tlkt7g2blnq3gigedhwgnrt5w7n6k5zyr3dvpadyrl2bn5p2d@v6rhkcmaeryo> |
On Sun, Feb 23, 2025 at 09:13:39PM GMT, Chris Hofstaedtler wrote: > * Chris Hofstaedtler <[email protected]> [250223 20:06]: > > > [..] After I sent this bug report yesterday, I also found out that > > > someone has reported what I believe is the same bug to > > > upstream a while ago ( https://github.com/util-linux/util-linux/issues/3304 > > > ) but so far nobody has commented on that report. > > > > Yeah, this seems like the same issue. > > Below is a patch that works, but certainly feels dirty: > > > From: Chris Hofstaedtler <[email protected]> > Date: Sun, 23 Feb 2025 20:10:05 +0100 > Subject: agetty: restore op->tty if getting the tty name fails > > Signed-off-by: Chris Hofstaedtler <[email protected]> > --- > term-utils/agetty.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/term-utils/agetty.c b/term-utils/agetty.c > index a382313..e65c985 100644 > --- a/term-utils/agetty.c > +++ b/term-utils/agetty.c > @@ -929,9 +929,11 @@ static void parse_args(int argc, char **argv, struct options *op) > /* resolve the tty path in case it was provided as stdin */ > if (strcmp(op->tty, "-") == 0) { > op->tty_is_stdin = 1; > + const char* tty_orig = op->tty; > int fd = get_terminal_name(NULL, &op->tty, NULL); > if (fd < 0) { > log_warn(_("could not get terminal name: %d"), fd); > + op->tty = tty_orig; > } Oh, I have implemented something like this https://github.com/util-linux/util-linux/pull/3425 Karel -- Karel Zak <[email protected]> http://karelzak.blogspot.com