1 Commits

Author SHA1 Message Date
Jiajie Li
0a067ff27f hw/usb: Fix buffer overflow in do_token_setup
Store calculated setup_len in a local variable, verify it, and only
write it to the struct (USBDevice->setup_len) in case it passed the
sanity checks.

This prevent other code (do_token_{in,out} functions specifically)
from working with invalid USBDevice->setup_len values and overruning
the USBDevice->setup_buf[] buffer.
Fixes: CVE-2020-14364
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-08-21 10:38:05 +08:00