Skip to content

Commit b72cf2c

Browse files
author
Górász Péter
committed
if data loss, exit
1 parent 41bd7af commit b72cf2c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libraries/ESP8266WebServer/src/Parsing.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,13 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
153153
plainLen += newLen;
154154
plainBuf[plainLen] = '\0';
155155
} while (plainLen < contentLength);
156+
/* if data loss, exit */
156157
if (plainBuf == nullptr) return false;
158+
if (plainLen < contentLength)
159+
{
160+
free(plainBuf);
161+
return false;
162+
}
157163
#ifdef DEBUG_ESP_HTTP_SERVER
158164
DEBUG_OUTPUT.print("Plain: ");
159165
DEBUG_OUTPUT.println(plainBuf);

0 commit comments

Comments
 (0)