Re: Bug#1098694: Crash in agetty due to invalid strncmp call in Trixie

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 23, 2025 at 09:13:39PM GMT, Chris Hofstaedtler wrote:
> * Chris Hofstaedtler <zeha@xxxxxxxxxx> [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 <zeha@xxxxxxxxxx>
> 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 <zeha@xxxxxxxxxx>
> ---
>  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  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com





[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux