Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6231980

Browse filesBrowse files
committed
I2CSlave: do not use vla
1 parent 6ca4422 commit 6231980
Copy full SHA for 6231980

File tree

1 file changed

+4
-3
lines changed
Filter options

1 file changed

+4
-3
lines changed

‎libraries/Wire/Wire.cpp

Copy file name to clipboardExpand all lines: libraries/Wire/Wire.cpp
+4-3Lines changed: 4 additions & 3 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.