Skip to content

Commit 9ac80d9

Browse files
gdsportscmaglie
gdsports
authored andcommitted
Fix memory overwrite in USBHost
Fix issue #271.
1 parent 3b38a41 commit 9ac80d9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

cores/arduino/USB/samd21_host.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,7 @@ void UHD_Init(void)
147147
USB->HOST.DESCADD.reg = (uint32_t)(&usb_pipe_table[0]);
148148
// For USB_SPEED_FULL
149149
uhd_force_full_speed();
150-
for (i = 0; i < sizeof(usb_pipe_table); i++)
151-
{
152-
(*(uint32_t *)(&usb_pipe_table[0] + i)) = 0;
153-
}
150+
memset((void *)usb_pipe_table, 0, sizeof(usb_pipe_table));
154151

155152
uhd_state = UHD_STATE_NO_VBUS;
156153

0 commit comments

Comments
 (0)