Skip to content

Commit 53e63eb

Browse files
committed
fix(transport): Fix websocket mem-corruption while reading headers
Closes #14473
1 parent a4a1e7b commit 53e63eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/tcp_transport/transport_ws.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static int ws_connect(esp_transport_handle_t t, const char *host, int port, int
285285
}
286286
int header_len = 0;
287287
do {
288-
if ((len = esp_transport_read(ws->parent, ws->buffer + header_len, WS_BUFFER_SIZE - header_len, timeout_ms)) <= 0) {
288+
if ((len = esp_transport_read(ws->parent, ws->buffer + header_len, WS_BUFFER_SIZE - 1 - header_len, timeout_ms)) <= 0) {
289289
ESP_LOGE(TAG, "Error read response for Upgrade header %s", ws->buffer);
290290
return -1;
291291
}

0 commit comments

Comments
 (0)