Buffer boundary check - test 1
This commit is contained in:
parent
383c903aa1
commit
1c0c744983
1 changed files with 122 additions and 118 deletions
|
@ -76,8 +76,12 @@ void receiveEvent(int byteCount)
|
|||
char buffer[byteCount];
|
||||
for (int i = 0; i < byteCount; i++)
|
||||
{
|
||||
if (i == byteCount)
|
||||
break;
|
||||
|
||||
buffer[i] = Wire.read();
|
||||
}
|
||||
|
||||
memset(receivedI2cData, ' ', 3);
|
||||
strcpy(receivedI2cData, buffer);
|
||||
}
|
||||
|
|
Reference in a new issue