Skip to content

Commit

Permalink
Merge pull request #6 from datacute/patch-1
Browse files Browse the repository at this point in the history
Corrected buffer overflow error
  • Loading branch information
ladyada committed Apr 17, 2017
2 parents 4d68350 + b5698bf commit 8f594c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion TinyWireM.cpp
Expand Up @@ -50,7 +50,7 @@ void USI_TWI::beginTransmission(uint8_t slaveAddr){ // setup address & write bit
}

size_t USI_TWI::write(uint8_t data){ // buffers up data to send
if (USI_BufIdx >= USI_BUF_SIZE) return 0; // dont blow out the buffer
if (USI_BufIdx >= USI_BUF_SIZE-1) return 0; // dont blow out the buffer
USI_BufIdx++; // inc for next byte in buffer
USI_Buf[USI_BufIdx] = data;
return 1;
Expand Down

0 comments on commit 8f594c6

Please sign in to comment.