DragonFlyBSD Kernel Audit
DF-1573 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/netif/oce/oce_sysctl.c b/sys/dev/netif/oce/oce_sysctl.c
--- a/sys/dev/netif/oce/oce_sysctl.c
+++ b/sys/dev/netif/oce/oce_sysctl.c
@@ -254,6 +254,8 @@
 	const struct flash_file_hdr *fhdr;
 	const struct image_hdr *img_ptr;
 
+	if (fw->datasize < sizeof(struct flash_file_hdr))
+		return EINVAL;
 	fhdr = (const struct flash_file_hdr *)fw->data;
 	if (fhdr->build[0] != '3') {
 		device_printf(sc->dev, "Invalid BE3 firmware image\n");