PERFORCE change 18877 for review

Brian Feldman green at freebsd.org
Mon Oct 7 20:21:40 GMT 2002


http://people.freebsd.org/~peter/p4db/chv.cgi?CH=18877

Change 18877 by green at green_laptop_2 on 2002/10/07 13:20:39

	Correct crashes related to not knowing what the correct minimum
	argc is.

Affected files ...

.. //depot/projects/trustedbsd/mac/usr.sbin/extattr/rmextattr.c#4 edit

Differences ...

==== //depot/projects/trustedbsd/mac/usr.sbin/extattr/rmextattr.c#4 (text+ko) ====

@@ -102,7 +102,8 @@
 	char	*buf, *visbuf, *p;
 
 	const char *options, *attrname;
-	int	 buflen, visbuflen, ch, error, i, arg_counter, attrnamespace;
+	int	 buflen, visbuflen, ch, error, i, arg_counter, attrnamespace,
+		 minargc;
 
 	int	flag_force = 0;
 	int	flag_quiet = 0;
@@ -118,15 +119,19 @@
 	if (!strcmp(p, "getextattr")) {
 		what = EAGET;
 		options = "fqsx";
+		minargc = 3;
 	} else if (!strcmp(p, "setextattr")) {
 		what = EASET;
 		options = "fq";
+		minargc = 4;
 	} else if (!strcmp(p, "rmextattr")) {
 		what = EARM;
 		options = "fq";
+		minargc = 3;
 	} else if (!strcmp(p, "lsextattr")) {
 		what = EALS;
 		options = "fq";
+		minargc = 2;
 	} else {
 		usage();
 	}
@@ -154,7 +159,7 @@
 	argc -= optind;
 	argv += optind;
 
-	if (argc < 2)
+	if (argc < minargc)
 		usage();
 
 	error = extattr_string_to_namespace(argv[0], &attrnamespace);
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list