summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Kuethe <ckuethe@cvs.openbsd.org>2010-06-29 17:15:24 +0000
committerChris Kuethe <ckuethe@cvs.openbsd.org>2010-06-29 17:15:24 +0000
commit36cf4afa6a6eadd9e6b1e49fe14adfc242ddcc8b (patch)
treed742893ac54a4336826cbcc59a4d2327d1ba86ce
parent39332be8792cfbf698a2722e6ce4bf8eaf817d5a (diff)
avoid a null pointer deref. ok jsg
-rw-r--r--usr.bin/usbhidaction/usbhidaction.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/usbhidaction/usbhidaction.c b/usr.bin/usbhidaction/usbhidaction.c
index 9e5ec9910c4..5f14949d134 100644
--- a/usr.bin/usbhidaction/usbhidaction.c
+++ b/usr.bin/usbhidaction/usbhidaction.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbhidaction.c,v 1.12 2009/10/21 15:48:27 sobrado Exp $ */
+/* $OpenBSD: usbhidaction.c,v 1.13 2010/06/29 17:15:23 ckuethe Exp $ */
/* $NetBSD: usbhidaction.c,v 1.7 2002/01/18 14:38:59 augustss Exp $ */
/*
@@ -400,6 +400,12 @@ docmd(struct command *cmd, int value, const char *hid, int argc, char **argv)
size_t len;
int n, r;
+ if (cmd->action == NULL){
+ if (verbose)
+ printf("no action for device %s value %d\n",
+ hid, value);
+ return;
+ }
for (p = cmd->action, q = cmdbuf; *p && q < &cmdbuf[SIZE-1]; ) {
if (*p == '$') {
p++;