1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Fixed buffer overflow in File::doBuffer() (dreggy)

Fixes #1580
This commit is contained in:
Cristian Maglie 2013-09-19 16:22:12 +02:00
parent fa04bd7323
commit be936dd590
2 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,9 @@
ARDUINO 1.5.5 BETA
[libraries]
* avr: Fixed buffer overflow in File::doBuffer() (dreggy)
ARDUINO 1.5.4 BETA 2013.09.10 ARDUINO 1.5.4 BETA 2013.09.10
[ide] [ide]

View File

@ -116,10 +116,10 @@ void File::doBuffer() {
if (buffered > 0) if (buffered > 0)
return; return;
// Try to buffer up to 32 characters // Try to buffer up to BUFFER_SIZE characters
readPos = 0; readPos = 0;
uint8_t cmd[] = {'G', handle, sizeof(buffer)}; uint8_t cmd[] = {'G', handle, BUFFER_SIZE - 1};
buffered = bridge.transfer(cmd, 3, buffer, sizeof(buffer)) - 1; buffered = bridge.transfer(cmd, 3, buffer, BUFFER_SIZE) - 1;
//err = buff[0]; // First byte is error code //err = buff[0]; // First byte is error code
if (buffered>0) { if (buffered>0) {
// Shift the reminder of buffer // Shift the reminder of buffer