fw: Add destination buffer size to read()

Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
Michael Cardell Widerkrantz 2023-02-27 16:41:31 +01:00 committed by Daniel Lublin
parent b292c72534
commit f386cec1ed
No known key found for this signature in database
GPG key ID: 75BD0FEB8D3E7830
3 changed files with 13 additions and 3 deletions

View file

@ -244,7 +244,11 @@ int main()
memset(cmd, 0, CMDLEN_MAXBYTES);
// Now we know the size of the cmd frame, read it all
read(cmd, hdr.len);
if (read(cmd, CMDLEN_MAXBYTES, hdr.len) != 0) {
htif_puts("read: buffer overrun\n");
forever_redflash();
// Not reached
}
// Is it for us?
if (hdr.endpoint != DST_FW) {