]> git.ipfire.org Git - thirdparty/systemd.git/commit
terminal-util: stop doing 0/upper bound check in tty_is_vc()
authorMike Yuan <me@yhndnzj.com>
Sun, 26 Jan 2025 00:32:42 +0000 (01:32 +0100)
committerMike Yuan <me@yhndnzj.com>
Sun, 26 Jan 2025 03:15:40 +0000 (04:15 +0100)
commitb27f791691b149ea660618dd93e7b9792d4e7680
tree0c12dc22c48ce60e8ef8ffb11448f18ebcfb604b
parentba0266b376d7cc5205d8a4a3d999aec13c24fe5d
terminal-util: stop doing 0/upper bound check in tty_is_vc()

tty_is_vc() is more often than not used for simple "categorization"
than validity check. E.g. in logind, we first recognize the tty
"looks like vc", and then use vtnr_from_tty() where range check
is performed and vtnr is extracted. In such cases, we want to reject
invalid vtnr from clients rather than silently carry on, hence
let's remove bound check in tty_is_vc().

Fixes #36166
Replaces #36167 and #36175
src/basic/terminal-util.c