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.

Modified files:

Index: src/sbin/bioctl/bioctl.c
diff -u src/sbin/bioctl/bioctl.c:1.12 src/sbin/bioctl/bioctl.c:1.13
--- src/sbin/bioctl/bioctl.c:1.12	Sun Jan 18 00:27:59 2009
+++ src/sbin/bioctl/bioctl.c	Sat Feb 20 22:25:54 2010
@@ -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));

Reply via email to