Skip to content

Commit 6231980

Browse files
committed
I2CSlave: do not use vla
1 parent 6ca4422 commit 6231980

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libraries/Wire/Wire.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,12 @@ void arduino::MbedI2C::receiveThd() {
159159
}
160160
if (usedTxBuffer != 0) {
161161
core_util_critical_section_enter();
162-
uint8_t tempTxBuffer[usedTxBuffer];
163-
memcpy(tempTxBuffer, txBuffer, sizeof(tempTxBuffer));
162+
uint8_t tempTxBuffer[256];
163+
uint8_t usedTempTxBuffer = usedTxBuffer;
164+
memcpy(tempTxBuffer, txBuffer, usedTempTxBuffer);
164165
usedTxBuffer = 0;
165166
core_util_critical_section_exit();
166-
slave->write((const char *) tempTxBuffer, sizeof(tempTxBuffer));
167+
slave->write((const char *) tempTxBuffer, usedTempTxBuffer);
167168
}
168169
//slave->stop();
169170
break;

0 commit comments

Comments
 (0)