]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: ignore ^C
authorKarel Zak <kzak@redhat.com>
Fri, 22 May 2020 08:22:12 +0000 (10:22 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 22 May 2020 08:22:12 +0000 (10:22 +0200)
Danc86 wrote:
 With agetty 2.32.1 and earlier, ^C at the login prompt is ignored. I
 noticed when upgrading to agetty 2.34, typing ^C now causes agetty to
 stop responding for 10 seconds and then it dies (and gets restarted by
 system and a new login prompt is printed).

 It logs this message:

   agetty[46048]: ttyS0: invalid character 0x3 in login name

 Previously the !isprint(ascval) condition would have caused control
 characters like ^C (\x03) to be discarded, whereas now it falls
 through to trying to decode it as part of a UTF-8 sequence, and then
 fails.

Fixes: http://github.com/karelzak/util-linux/commit/5de9751997cf490088f62f41fd92be57cf7ceea4
Addresses: https://github.com/karelzak/util-linux/issues/1046
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/agetty.c

index 73041c5c61935227c93c27bdf500394fb2ee4c62..8854798f6dc144795d70bff3839902681f584b08 100644 (file)
@@ -2271,6 +2271,9 @@ static char *get_logname(struct issue *ie, struct options *op, struct termios *t
                                break;
                        case CTL('D'):
                                exit(EXIT_SUCCESS);
+                       case CTL('C'):
+                               /* Ignore */
+                               break;
                        default:
                                if ((size_t)(bp - logname) >= sizeof(logname) - 1)
                                        log_err(_("%s: input overrun"), op->tty);