summaryrefslogtreecommitdiff
path: root/usr.bin/modstat
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-06 18:17:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-06 18:17:23 +0000
commite274c783620ae46369fa97207ec7b48c640eb3dc (patch)
tree0f386535269e2f60c4c56ba159bad5a337e358f8 /usr.bin/modstat
parentdd0bf0ec44fe020240987632584446cf0048ad1a (diff)
fix usage, buf oflow, pretty usage
Diffstat (limited to 'usr.bin/modstat')
-rw-r--r--usr.bin/modstat/modstat.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/modstat/modstat.c b/usr.bin/modstat/modstat.c
index 3a423c3c573..e9d65542433 100644
--- a/usr.bin/modstat/modstat.c
+++ b/usr.bin/modstat/modstat.c
@@ -1,4 +1,5 @@
-/* * $OpenBSD: modstat.c,v 1.5 1996/08/05 11:11:41 mickey Exp $*/
+/* $OpenBSD: modstat.c,v 1.6 1996/08/06 18:17:22 deraadt Exp $ */
+
/*
* Copyright (c) 1993 Terrence R. Lambert.
* All rights reserved.
@@ -51,7 +52,7 @@ usage()
{
fprintf(stderr,
- "usage: modstat [-i <module id>] [-n <module name>]\n");
+ "usage: modstat [-i moduleid] [-n modulename]\n");
exit(1);
}
@@ -76,8 +77,11 @@ dostat(devfd, modnum, modname)
sbuf.id = modnum;
sbuf.name = name;
- if (modname != NULL)
+ if (modname != NULL) {
+ if (strlen(modname) >= sizeof(sbuf.name))
+ return 4;
strcpy(sbuf.name, modname);
+ }
if (ioctl(devfd, LMSTAT, &sbuf) == -1) {
switch (errno) {
@@ -137,10 +141,8 @@ main(argc, argv)
case 'n':
modname = optarg;
break; /* name */
- case '?':
- usage();
default:
- printf("default!\n");
+ usage();
break;
}
}