NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/39946: Fix bioctl(8) argc handling in some commands



>Number:         39946
>Category:       kern
>Synopsis:       Fix bioctl(8) argc handling in some commands
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 18 10:15:01 +0000 2008
>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));



Home | Main Index | Thread Index | Old Index