bhyve: improve bounds checks in hda_codec
The function hda_codec_command is vulnerable to buffer over-read, the
payload value is extracted from the command and used as an array index
without any validation.
Fortunately, the payload value is capped at 255, so the information
disclosure is limited and only a small part of .rodata of bhyve binary
can be disclosed.
The risk is low because the leaked information is not sensitive. An
attacker may be able to validate the version of the bhyve binary using
this information disclosure (layout of .rodata information, ex:
jmp_tables) before executing an exploit.
Reported by: Synacktiv
Reviewed by: christos, emaste
Security: HYP-13
Security: FreeBSD-SA-24:17.bhyve
Approved by: so
Sponsored by: The Alpha-Omega Project
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46098
(cherry picked from commit e94a1d6a7f2eb932850e1db418bf34d5c6991ce8)
(cherry picked from commit 757bbf484c0bab2c4c7b504017079cceb833f7ae)
(cherry picked from commit 6cb1995a66aec98261256bc4da3eedfe840e1ab9)