summaryrefslogtreecommitdiff
path: root/sys/dev/firmload.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/firmload.c')
-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;