From c0f8ce9d8456d1a28da66de2f15c049d8fdcab26 Mon Sep 17 00:00:00 2001 From: JohnSL Date: Sun, 8 Nov 2015 19:28:55 -0800 Subject: [PATCH] Exclude the terminator in sendContent_P The terminator should not be sent by sendContent_P. For example, if you have a null-terminated string, the null itself should not be sent to the client. This change decrements the number of bytes to send so it does not include the termination character. --- libraries/ESP8266WebServer/src/ESP8266WebServer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp b/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp index 0c5556306..075437706 100644 --- a/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp +++ b/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp @@ -226,8 +226,8 @@ void ESP8266WebServer::sendContent_P(PGM_P content) { contentUnitLen = HTTP_DOWNLOAD_UNIT_SIZE; } else { - // reached terminator - contentUnitLen = contentNext - contentUnit; + // reached terminator. Do not send the terminator + contentUnitLen = contentNext - contentUnit - 1; content = NULL; }