Source-Changes-HG archive

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

[src/trunk]: src/sbin/bioctl Fix two problems with argc handling in bioctl(8)...



details:   https://anonhg.NetBSD.org/src/rev/13318ef4c9d4
branches:  trunk
changeset: 752241:13318ef4c9d4
user:      ahoka <ahoka%NetBSD.org@localhost>
date:      Sat Feb 20 22:25:54 2010 +0000

description:
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).

diffstat:

 sbin/bioctl/bioctl.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r a424d03ece44 -r 13318ef4c9d4 sbin/bioctl/bioctl.c
--- a/sbin/bioctl/bioctl.c      Sat Feb 20 19:04:48 2010 +0000
+++ b/sbin/bioctl/bioctl.c      Sat Feb 20 22:25:54 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bioctl.c,v 1.12 2009/01/18 00:27:59 lukem Exp $ */
+/* $NetBSD: bioctl.c,v 1.13 2010/02/20 22:25:54 ahoka Exp $ */
 /* $OpenBSD: bioctl.c,v 1.52 2007/03/20 15:26:06 jmc Exp $ */
 
 /*
@@ -31,7 +31,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: bioctl.c,v 1.12 2009/01/18 00:27:59 lukem Exp $");
+__RCSID("$NetBSD: bioctl.c,v 1.13 2010/02/20 22:25:54 ahoka Exp $");
 #endif
 
 #include <sys/types.h>
@@ -601,7 +601,7 @@
        char                    *endptr;
        bool                    rem = false;
 
-       if (argc > 3)
+       if (argc < 2 || argc > 3)
                usage();
 
        memset(&bs, 0, sizeof(bs));
@@ -640,7 +640,7 @@
        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