⬢ DragonFlyBSD Kernel Audit
DF-4386 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/oce/oce_mbox.c
+++ b/sys/dev/netif/oce/oce_mbox.c
@@ -286,7 +286,11 @@
 		goto error;
 	}
 
-	bcopy(fwcmd->params.rsp.fw_ver_str, sc->fw_version, 32);
+	bcopy(fwcmd->params.rsp.fw_ver_str, sc->fw_version,
+	    sizeof(sc->fw_version));
+	/* device strings are not guaranteed NUL-terminated and the
+	 * firmware_version sysctl is served via strlen() */
+	sc->fw_version[sizeof(sc->fw_version) - 1] = '\0';
 error:
 	return ret;
 }