From 4b0a87b40580c21d4daaf1c0e426985e0c27ac47 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Thu, 18 Aug 2011 15:13:47 -0400 Subject: [PATCH] Stream.readBytesUntil() now writes null terminator within length. --- hardware/arduino/cores/arduino/Stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/cores/arduino/Stream.cpp b/hardware/arduino/cores/arduino/Stream.cpp index bf8304f2d..d267bf0cb 100644 --- a/hardware/arduino/cores/arduino/Stream.cpp +++ b/hardware/arduino/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 !