Skip to content

Commit 732db59

Browse files
authored
Catch a possible null-dereference (esp8266#8508)
1 parent a736a95 commit 732db59

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&
254254
}
255255

256256
WiFiClient * tcp = http.getStreamPtr();
257+
if (!tcp) {
258+
DEBUG_HTTP_UPDATE("[httpUpdate] WiFiClient connection unexpectedly absent\n");
259+
_setLastError(HTTPC_ERROR_CONNECTION_LOST);
260+
http.end();
261+
return HTTP_UPDATE_FAILED;
262+
}
257263

258264
if (_closeConnectionsOnUpdate) {
259265
WiFiUDP::stopAll();

0 commit comments

Comments
 (0)