NetBSD Problem Report #39946

From www@NetBSD.org  Tue Nov 18 10:14:46 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id F2A7D63BC49
	for <gnats-bugs@gnats.netbsd.org>; Tue, 18 Nov 2008 10:14:45 +0000 (UTC)
Message-Id: <20081118101445.BF80F63B874@narn.NetBSD.org>
Date: Tue, 18 Nov 2008 10:14:45 +0000 (UTC)
From: xtraeme@gmail.com
Reply-To: xtraeme@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Fix bioctl(8) argc handling in some commands
X-Send-Pr-Version: www-1.0

>Number:         39946
>Category:       bin
>Synopsis:       Fix bioctl(8) argc handling in some commands
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 18 10:15:01 +0000 2008
>Closed-Date:    Sat Feb 20 22:26:42 +0000 2010
>Last-Modified:  Sat Feb 20 22:30:02 +0000 2010
>Originator:     Juan RP
>Release:        Latest
>Organization:
>Environment:
NetBSD nocturno 5.99.02 NetBSD 5.99.02 (MASTER) #0: Tue Nov 18 10:04:43 CET 2008  juan@nocturno:/mnt/raid/build/i386/obj/sys/arch/i386/compile/MASTER i386
>Description:
I've found two problems with argc handling in bioctl(8), which makes
bioctl(8) dump core if expected arguments are not passed in.
>How-To-Repeat:

>Fix:
Apply this patch and request pullup to netbsd-[45]:

Index: bioctl.c
===================================================================
RCS file: /cvsroot/src/sbin/bioctl/bioctl.c,v
retrieving revision 1.11
diff -b -u -p -r1.11 bioctl.c
--- bioctl.c    3 Mar 2008 16:10:48 -0000       1.11
+++ bioctl.c    18 Nov 2008 09:36:19 -0000
@@ -601,7 +601,7 @@ bio_setstate_passthru(int fd, int argc, 
        char                    *endptr;
        bool                    rem = false;

-       if (argc > 3)
+       if (argc < 2 || argc > 3)
                usage();

        memset(&bs, 0, sizeof(bs));
@@ -640,7 +640,7 @@ bio_setstate_consistency(int fd, int arg
        struct bioc_setstate    bs;
        char                    *endptr;

-       if (argc > 2)
+       if (argc != 2)
                usage();

        memset(&bs, 0, sizeof(bs));

>Release-Note:

>Audit-Trail:
From: "Juan Romero Pardines" <xtraeme@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/39946: Fix bioctl(8) argc handling in some commands
Date: Tue, 18 Nov 2008 11:35:41 +0100

 This should have been bin category rather than kern.

Responsible-Changed-From-To: kern-bug-people->bin-bug-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Tue, 18 Nov 2008 12:14:55 +0000
Responsible-Changed-Why:
correct category


State-Changed-From-To: open->closed
State-Changed-By: ahoka@NetBSD.org
State-Changed-When: Sat, 20 Feb 2010 22:26:42 +0000
State-Changed-Why:
COmitted, thanks!


From: Adam Hoka <ahoka@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39946 CVS commit: src/sbin/bioctl
Date: Sat, 20 Feb 2010 22:25:54 +0000

 Module Name:	src
 Committed By:	ahoka
 Date:		Sat Feb 20 22:25:54 UTC 2010

 Modified Files:
 	src/sbin/bioctl: bioctl.c

 Log Message:
 Fix two problems with argc handling in bioctl(8), which makes
 bioctl(8) dump core if expected arguments are not passed in.

 Closes PR bin/39946 (patch by Juan RP).


 To generate a diff of this commit:
 cvs rdiff -u -r1.12 -r1.13 src/sbin/bioctl/bioctl.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.