From gdonl@tsc.tdk.com  Thu Feb  6 00:14:29 1997
Received: from who.cdrom.com (who.cdrom.com [204.216.27.3])
          by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id AAA09824
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 6 Feb 1997 00:14:29 -0800 (PST)
Received: from gatekeeper.tsc.tdk.com (root@gatekeeper.tsc.tdk.com [207.113.159.21])
          by who.cdrom.com (8.7.5/8.6.11) with ESMTP id XAA18077
          for <FreeBSD-gnats-submit@freebsd.org>; Wed, 5 Feb 1997 23:59:57 -0800 (PST)
Received: from sunrise.gv.tsc.tdk.com (root@sunrise.gv.tsc.tdk.com [192.168.241.191])
          by gatekeeper.tsc.tdk.com (8.8.4/8.8.4) with ESMTP
	  id XAA03773 for <FreeBSD-gnats-submit@freebsd.org>; Wed, 5 Feb 1997 23:59:56 -0800 (PST)
Received: from w3.gv.tsc.tdk.com (gdonl@w3.gv.tsc.tdk.com [192.168.240.195])
          by sunrise.gv.tsc.tdk.com (8.8.4/8.8.4) with ESMTP
	  id XAA13398 for <FreeBSD-gnats-submit@freebsd.org>; Wed, 5 Feb 1997 23:59:55 -0800 (PST)
Received: (from gdonl@localhost)
          by w3.gv.tsc.tdk.com (8.8.5/8.8.4)
	  id XAA00978; Wed, 5 Feb 1997 23:59:52 -0800 (PST)
Message-Id: <199702060759.XAA00978@w3.gv.tsc.tdk.com>
Date: Wed, 5 Feb 1997 23:59:52 -0800 (PST)
From: Don Lewis <Don.Lewis@tsc.tdk.com>
Reply-To: gdonl@tsc.tdk.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: modstat passes garbage name to kernel if name is not specified
X-Send-Pr-Version: 3.2

>Number:         2676
>Category:       bin
>Synopsis:       modstat passes garbage name to kernel if name is not specified
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb  6 00:20:02 PST 1997
>Closed-Date:    Thu Feb 6 06:29:52 PST 1997
>Last-Modified:  Thu Feb  6 06:30:43 PST 1997
>Originator:     Don Lewis
>Release:        FreeBSD 2.1.6-internal-0225 i386
>Organization:
TDK Semiconductor
>Environment:


>Description:

	If a module name is not specified on the command line for modstat,
	it fails to initialize the name field of the lmc_stat structure
	before passing this to the ioctl() call.  This results in whatever
	random garbage is contained on the stack being used as the module
	name.

	This bug is present in all releases through -current.

>How-To-Repeat:

	Run modstat without specifying a module name.

>Fix:
	
	Clear the sbuf.name[] array in dostat() with bzero() or equivalent
	instead of just NUL terminating it.

>Release-Note:
>Audit-Trail:

From: Mike Pritchard <mpp>
To: gdonl@tsc.tdk.com
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/2676: modstat passes garbage name to kernel if name is not specified
Date: Thu, 6 Feb 1997 06:00:17 -0800 (PST)

 Does this cause modstat to not work?  From examining the
 sources (3.0 and 2.2) to modstat, and the kernel, there should
 not be a need to ensure that lmc_stat.name is zeroed out.
 The ioctl should either be called with lmc_stat.id == -1
 and a module name properly set in lmc_stat.name, or it
 will be called with a lmc_stat.id >= 0 and lmc_stat.name
 will be ignored by the ioctl.
 
 Don Lewis wrote:
 > 
 > 
 > >Number:         2676
 > >Category:       bin
 > >Synopsis:       modstat passes garbage name to kernel if name is not specified
 > >Description:
 > 
 > 	If a module name is not specified on the command line for modstat,
 > 	it fails to initialize the name field of the lmc_stat structure
 > 	before passing this to the ioctl() call.  This results in whatever
 > 	random garbage is contained on the stack being used as the module
 > 	name.
 > 
 > 	This bug is present in all releases through -current.
 > 
 > >How-To-Repeat:
 > 
 > 	Run modstat without specifying a module name.
 > >Fix:
 > 	
 > 	Clear the sbuf.name[] array in dostat() with bzero() or equivalent
 > 	instead of just NUL terminating it.
 -- 
 Mike Pritchard
 mpp@FreeBSD.org
 "Go that way.  Really fast.  If something gets in your way, turn"
State-Changed-From-To: open->closed 
State-Changed-By: mpp 
State-Changed-When: Thu Feb 6 06:29:52 PST 1997 
State-Changed-Why:  
The PR author and I both agree that this is a non-problem. 
>Unformatted:
