Skip to content

Commit 50f1a89

Browse files
Add an error check for empty path of an URL
1 parent 92ce408 commit 50f1a89

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libraries/HTTPClient/src/HTTPClient.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ bool HTTPClient::beginInternal(String url, const char* expectedProtocol)
261261
url.remove(0, (index + 3)); // remove http:// or https://
262262

263263
index = url.indexOf('/');
264+
if (index == -1) {
265+
log_e("the path of url must not be empty");
266+
return false;
267+
}
264268
String host = url.substring(0, index);
265269
url.remove(0, index); // remove host part
266270

0 commit comments

Comments
 (0)