summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorPatrick Latifi <pat@cvs.openbsd.org>2005-02-28 01:17:20 +0000
committerPatrick Latifi <pat@cvs.openbsd.org>2005-02-28 01:17:20 +0000
commit7f449026218631b6690f4f52def0f279ba1088f8 (patch)
tree5213b564409bbe52cf39aaceebdfe3a1ede84036 /sys/dev
parenta219aac733c075e03343858b7aa4981f49a44e9a (diff)
Don't bother trying to load an empty firmware file.
ok deraadt
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/firmload.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/firmload.c b/sys/dev/firmload.c
index 9b53209ef0c..5c370cad08e 100644
--- a/sys/dev/firmload.c
+++ b/sys/dev/firmload.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: firmload.c,v 1.3 2004/11/17 16:16:09 deraadt Exp $ */
+/* $OpenBSD: firmload.c,v 1.4 2005/02/28 01:17:19 pat Exp $ */
/*
* Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org>
@@ -52,6 +52,10 @@ loadfirmware(const char *name, u_char **bufp, size_t *buflen)
error = VOP_GETATTR(nid.ni_vp, &va, p->p_ucred, p);
if (error)
goto fail;
+ if (va.va_size == 0) {
+ error = EINVAL;
+ goto fail;
+ }
if (va.va_size > FIRMWARE_MAX) {
error = E2BIG;
goto fail;