diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-12-11 20:24:49 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-12-11 20:24:49 +0000 |
commit | 209ef91d0a146167dc6e824a206d5acc345e4fab (patch) | |
tree | dca37756bae2384226a42c78e20395c8566deecf /sys/dev/isa | |
parent | b53b1e70cde025b6210708e8f5e7c62d7c5ef2aa (diff) |
Do not blindly dereference hw_vendor and hw_prod without checking them for
NULL first, for they are not guaranteed to be allocated.
Found the hard way by Tobias Stoeckmann; ok deraadt@
Diffstat (limited to 'sys/dev/isa')
-rw-r--r-- | sys/dev/isa/skgpio.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/isa/skgpio.c b/sys/dev/isa/skgpio.c index af303ab4dd1..6d118ea7b16 100644 --- a/sys/dev/isa/skgpio.c +++ b/sys/dev/isa/skgpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: skgpio.c,v 1.1 2014/12/10 05:42:25 jsg Exp $ */ +/* $OpenBSD: skgpio.c,v 1.2 2014/12/11 20:24:48 miod Exp $ */ /* * Copyright (c) 2014 Matt Dainty <matt@bodgit-n-scarper.com> @@ -89,8 +89,9 @@ skgpio_match(struct device *parent, void *match, void *aux) struct isa_attach_args *ia = aux; bus_space_handle_t ioh; - if (strcmp(hw_vendor, "Soekris Engineering") || - strcmp(hw_prod, "net6501")) + if (hw_vendor == NULL || hw_prod == NULL || + strcmp(hw_vendor, "Soekris Engineering") != 0 || + strcmp(hw_prod, "net6501") != 0) return (0); if (ia->ia_iobase != SKGPIO_BASE || bus_space_map(ia->ia_iot, |