From nobody  Wed Apr  1 02:40:10 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id CAA01330;
          Wed, 1 Apr 1998 02:40:10 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199804011040.CAA01330@hub.freebsd.org>
Date: Wed, 1 Apr 1998 02:40:10 -0800 (PST)
From: dmorrisn@u.washington.edu
To: freebsd-gnats-submit@freebsd.org
Subject: screensaver permanently active when no bounds checking for blanktime in sysinstall
X-Send-Pr-Version: www-1.0

>Number:         6188
>Category:       bin
>Synopsis:       screensaver permanently active when no bounds checking for blanktime in sysinstall
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr  1 02:50:02 PST 1998
>Closed-Date:    Mon Aug 3 02:21:16 PDT 1998
>Last-Modified:  Mon Aug  3 02:22:04 PDT 1998
>Originator:     Don Morrison
>Release:        2.2.6
>Organization:
N/A (student)
>Environment:
FreeBSD D-128-95-253-128.dhcp.washington.edu 2.2.6-STABLE FreeBSD 2.2.6-STABLE #0: Sun Mar 29 00:47:36 PST 1998     root@D-128-95-253-128.dhcp.washington.edu:/usr/src/sys/compile/MINE  i386
>Description:
/stand/sysinstall does not make bounds checks for the screensaver
time-out interval.  When this value is read from /etc/rc.conf at startup
and is excessively high it can cause the screensaver to take over the
screen by remaining continuously active.  The user can type commands,
but cannot see the output.  This is only a bit annoying, but a new user
might not know how to correct the problem.
>How-To-Repeat:
Enter the /stand/sysinstall program.  Enter the Post-Install Configuration
Menu.  Select Console settings.  Select Screensaver settings.  Select the
time-out interval setting and enter 2147483648.  Exit the sysinstall
program and reboot.  The screensaver should take over the screen as soon
as it is started by the startup script.
>Fix:
*** /usr/src/release/sysinstall/config.c.orig   Wed Apr  1 00:13:25 1998
--- /usr/src/release/sysinstall/config.c        Wed Apr  1 01:53:02 1998
***************
*** 461,469 ****
  int
  configSaverTimeout(dialogMenuItem *self)
  {
!     return (variable_get_value(VAR_BLANKTIME,
!           "Enter time-out period in seconds for screen saver") ?
!           DITEM_SUCCESS : DITEM_FAILURE) | DITEM_RESTORE;
  }
  
  int
--- 461,479 ----
  int
  configSaverTimeout(dialogMenuItem *self)
  {
!     int blanktime;
! 
!     if (!variable_get_value(VAR_BLANKTIME,
!            "Enter time-out period in seconds for screen saver"))
!       return DITEM_FAILURE | DITEM_RESTORE;
! 
!     blanktime = atoi(variable_get(VAR_BLANKTIME));
!     if ( blanktime <= 0 )
!      variable_set2(VAR_BLANKTIME, "NO");
!     else if ( blanktime > USHRT_MAX )
!      variable_set2(VAR_BLANKTIME, itoa(USHRT_MAX));
! 
!     return DITEM_SUCCESS | DITEM_RESTORE;
  }
  
  int
>Release-Note:
>Audit-Trail:

From: "Jordan K. Hubbard" <jkh@time.cdrom.com>
To: dmorrisn@u.washington.edu
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/6188: screensaver permanently active when no bounds checking for blanktime in sysinstall 
Date: Wed, 01 Apr 1998 03:00:42 -0800

 > /stand/sysinstall does not make bounds checks for the screensaver
 > time-out interval.  When this value is read from /etc/rc.conf at startup
 
 True enough, but considering that anyone can also change the time-out
 value to a bogus one by typing ``vi /etc/rc.conf'' (substitute your
 favorite editor here ;-), I think the fix doesn't belong in sysinstall
 so much as it does in vidcontrol (which should simply refuse to set a
 bogus timeout value, preventing its direct abuse on the command line
 as well).
 
 					Jordan

From: Don Morrison <dmorrisn@u.washington.edu>
To: "Jordan K. Hubbard" <jkh@time.cdrom.com>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/6188: screensaver permanently active when no bounds checking for blanktime in sysinstall
Date: Wed, 01 Apr 1998 03:15:46 -0800

 > > /stand/sysinstall does not make bounds checks for the screensaver
 > > time-out interval.  When this value is read from /etc/rc.conf at startup
 >
 > True enough, but considering that anyone can also change the time-out
 > value to a bogus one by typing ``vi /etc/rc.conf'' (substitute your
 > favorite editor here ;-), I think the fix doesn't belong in sysinstall
 > so much as it does in vidcontrol (which should simply refuse to set a
 > bogus timeout value, preventing its direct abuse on the command line
 > as well).
 >
 >                                         Jordan
 
 
 I'm sorry, you are correct.  It's just as easy to fix there and it actually
 fixes the problem (completely.)
 

From: Don Morrison <dmorrisn@u.washington.edu>
To: bug-followup@FreeBSD.ORG
Cc:  Subject: Re:bin/6188: screensaver permanently active because of no upper-bounds checking of blanktime in vidcontrol
Date: Thu, 02 Apr 1998 00:03:30 -0800

 Here's another reasonable patch for this:
 
 *** /usr/src/usr.sbin/vidcontrol/vidcontrol.c.orig      Wed Apr  1
 23:43:58 1998
 --- /usr/src/usr.sbin/vidcontrol/vidcontrol.c   Wed Apr  1 23:42:50 1998
 
 ***************
 *** 36,41 ****
 --- 36,42 ----
   #include <stdio.h>
   #include <stdlib.h>
   #include <machine/console.h>
 + #include <machine/limits.h>
   #include <sys/errno.h>
   #include "path.h"
 
 ***************
 *** 222,229 ****
                 nsec = 0;
         else {
                 nsec = atoi(arg);
 !               if ((*arg == '\0') || (nsec < 1)) {
 !                       warnx("argument must be a positive number");
                         return;
                 }
         }
 --- 223,230 ----
                 nsec = 0;
         else {
                 nsec = atoi(arg);
 !               if ((*arg == '\0') || (nsec < 1) || (nsec > USHRT_MAX))
 {
 !                       warnx("blanktime out of range");
                         return;
                 }
         }
 
 
State-Changed-From-To: open->closed 
State-Changed-By: yokota 
State-Changed-When: Mon Aug 3 02:21:16 PDT 1998 
State-Changed-Why:  
Fixed in syscons.c 1.269 rather than in vidcontrol as suggested in the PR. 
>Unformatted:
