summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorckuethe <ckuethe@openbsd.org>2010-06-29 17:15:23 +0000
committerckuethe <ckuethe@openbsd.org>2010-06-29 17:15:23 +0000
commit940c232b6aff7c086e84142a089d5e67344f34db (patch)
tree852aa66aba13b6519f27d2ae51363f1546dc7904
parentRemove the "if the string address faulted, see if it looks like an int" (diff)
downloadwireguard-openbsd-940c232b6aff7c086e84142a089d5e67344f34db.tar.xz
wireguard-openbsd-940c232b6aff7c086e84142a089d5e67344f34db.zip
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++;