From 7f449026218631b6690f4f52def0f279ba1088f8 Mon Sep 17 00:00:00 2001 From: Patrick Latifi Date: Mon, 28 Feb 2005 01:17:20 +0000 Subject: Don't bother trying to load an empty firmware file. ok deraadt --- sys/dev/firmload.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sys/dev') 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 @@ -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; -- cgit v1.2.3