ports/57052: [patch] graphics/svgalib checks wrong virtual console for ownership

Alexey Dokuchaev danfe at regency.nsu.ru
Sun Sep 21 09:20:22 UTC 2003


>Number:         57052
>Category:       ports
>Synopsis:       [patch] graphics/svgalib checks wrong virtual console for ownership
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 21 02:20:19 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Alexey Dokuchaev
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
CNIT NSU
>Environment:
System: FreeBSD regency.nsu.ru 4.8-STABLE FreeBSD 4.8-STABLE #0: Fri Aug 8 20:27:14 NOVST 2003 root at regency.nsu.ru:/usr/obj/usr/src/sys/REGENCY i386
>Description:
graphics/svgalib contains an off-by-one error in the code that checks
that the user is the owner of the current virtual terminal.  Instead
of checking /dev/ttyv[X], it checks /dev/ttyv[X+1].

Submitted by:	Chris Pressey <cpressey at catseye.mine.nu>

This happens because svgalib was written for Linnex, and they start tty
numbering from 1, contrary to FreeBSD, which does it from 0.  I
always knew that FreeBSD is better: who counts from 1 in this world?! ;-)
>How-To-Repeat:
Log in as a non-root user on ttyv0.  Make sure that this user is not
also logged in on ttyv1.  Run a program that uses graphics/svgalib (such
as seejpeg, or Quake game).  SVGAlib will produce an error to the effect
that you are not the owner of the current virtual console.  Log in as
the same user on ttyv1.  Switch back to ttyv0 and try running seejpeg a
second time.  This time it should work, as the user on ttyv0 also owns
ttyv1.
>Fix:
--- patch-am.patch begins here ---
--- files/patch-am.orig	Sat Sep 20 13:06:12 2003
+++ files/patch-am	Sat Sep 20 13:06:30 2003
@@ -83,7 +83,7 @@
          return 1;               /* root can do it always */
  #endif
 -    sprintf(fname, "/dev/tty%d", vc);
-+    sprintf(fname, "/dev/ttyv%x", vc);
++    sprintf(fname, "/dev/ttyv%x", vc - 1);
      if ((stat(fname, &sbuf) >= 0) && (getuid() == sbuf.st_uid)) {
          return 1;
      }
--- patch-am.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list