Skip to content

Commit bba50c7

Browse files
committed
Wire: avoid buffer overflow in arduino::ZephyrI2C::write(uint8_t)
Signed-off-by: Jakub Zimnol <zimnol.jakub@gmail.com>
1 parent 939a22d commit bba50c7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

libraries/Wire/Wire.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ size_t arduino::ZephyrI2C::requestFrom(uint8_t address, size_t len) { // TODO fo
6969
}
7070

7171
size_t arduino::ZephyrI2C::write(uint8_t data) { // TODO for ADS1115
72+
if (usedTxBuffer >= sizeof(txBuffer)) {
73+
return 0;
74+
}
7275
txBuffer[usedTxBuffer++] = data;
7376
return 1;
7477
}

0 commit comments

Comments
 (0)