diff --git a/cores/arduino/Stream.cpp b/cores/arduino/Stream.cpp index bf8304f..d267bf0 100644 --- a/cores/arduino/Stream.cpp +++ b/cores/arduino/Stream.cpp @@ -214,7 +214,7 @@ int Stream::readBytesUntil( char terminator, char *buffer, size_t length) { int index = 0; *buffer = 0; - while(index < length ){ + while(index < length-1 ){ int c = timedRead(); if( c <= 0 ){ return 0; // timeout returns 0 !