⬢ DragonFlyBSD Kernel Audit
DF-5224 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/amd/display/dc/bios/bios_parser_helper.c b/sys/dev/drm/amd/display/dc/bios/bios_parser_helper.c
index 1111111..2222222 100644
--- a/sys/dev/drm/amd/display/dc/bios/bios_parser_helper.c
+++ b/sys/dev/drm/amd/display/dc/bios/bios_parser_helper.c
@@ -37,7 +37,8 @@ uint8_t *bios_get_image(struct dc_bios *bp,
 	uint32_t offset,
 	uint32_t size)
 {
-	if (bp->bios && offset + size < bp->bios_size)
+	if (bp->bios && offset < bp->bios_size &&
+			size <= bp->bios_size - offset)
 		return bp->bios + offset;
 	else
 		return NULL;