Skip to content

Commit

Permalink
Wire: Fix buffer overflow in requestFrom.
Browse files Browse the repository at this point in the history
Fixes #813.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
  • Loading branch information
iabdalkader committed Apr 19, 2024
1 parent 59ec204 commit 461013c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libraries/Wire/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ uint8_t arduino::MbedI2C::endTransmission(void) {

size_t arduino::MbedI2C::requestFrom(uint8_t address, size_t len, bool stopBit) {
char buf[256];
len = min(len, sizeof(buf));
int ret = master->read(address << 1, buf, len, !stopBit);
if (ret != 0) {
return 0;
Expand Down

0 comments on commit 461013c

Please sign in to comment.