Merge pull request #1227 from kkitayam/fix_dcd_musb_buffer_overrun

Fix buffer overrun in dcd_musb driver
This commit is contained in:
Ha Thach 2021-12-06 00:43:25 +07:00 committed by GitHub
commit f8288be03f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -250,12 +250,12 @@ static void pipe_read_packet(void *buf, volatile void *fifo, unsigned len)
len -= 4; len -= 4;
} }
if (len >= 2) { if (len >= 2) {
*(uint32_t *)addr = reg->u16; *(uint16_t *)addr = reg->u16;
addr += 2; addr += 2;
len -= 2; len -= 2;
} }
if (len) { if (len) {
*(uint32_t *)addr = reg->u8; *(uint8_t *)addr = reg->u8;
} }
} }