Skip to content

Commit c0f8ce9

Browse files
committed
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.
1 parent 810ab68 commit c0f8ce9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/ESP8266WebServer/src/ESP8266WebServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ void ESP8266WebServer::sendContent_P(PGM_P content) {
226226
contentUnitLen = HTTP_DOWNLOAD_UNIT_SIZE;
227227
}
228228
else {
229-
// reached terminator
230-
contentUnitLen = contentNext - contentUnit;
229+
// reached terminator. Do not send the terminator
230+
contentUnitLen = contentNext - contentUnit - 1;
231231
content = NULL;
232232
}
233233

0 commit comments

Comments
 (0)