arduino / ArduinoCore-sam

80 stars 107 forks source link

HID.sendReport - Stack overflow #134

Open DesperateProgrammer opened 2 years ago

DesperateProgrammer commented 2 years ago

https://github.com/arduino/ArduinoCore-sam/blob/790ff2c852bf159787a9966bddee4d9f55352d15/libraries/HID/src/HID.cpp#L88

The length argument is unchecked and will cause a stack overflow if >63. Allthough most HID messages are less than 63 bytes long, yet it is possible for HID reports to exceed this limit and occupy multiple USB interrupt frames. Sending such reports would crash the sketch.