[Bug 16333] New: Possible wrong tty in fallback path of cttyhack

bugzilla at busybox.net bugzilla at busybox.net
Sun Apr 13 00:38:00 UTC 2025


https://bugs.busybox.net/show_bug.cgi?id=16333

            Bug ID: 16333
           Summary: Possible wrong tty in fallback path of cttyhack
           Product: Busybox
           Version: 1.37.x
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: tg at debian.org
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

The code currently reads:

                        if (ioctl(0, VT_GETSTATE, &u.vt) == 0) {
                                /* this is linux virtual tty */
                                sprintf(console + 8, "S%u" + 1,
(int)u.vt.v_active);
                                break;
                        }
#endif
#ifdef TIOCGSERIAL
                        if (ioctl(0, TIOCGSERIAL, &u.sr) == 0) {
                                /* this is a serial console; assuming it is
named /dev/ttySn */
                                sprintf(console + 8, "S%u", (int)u.sr.line);
                                break;
                        }

Methinks the *first* of these two snprintfs without the n should be "%u"
instead of "S%u".

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list