Skip to content

koiosdigital/esp_websocket_client

Repository files navigation

ESP WEBSOCKET CLIENT (Koios fork)

Fork of espressif/esp_websocket_client v1.7.0 carrying two use-after-free fixes for cross-task TLS teardown:

  1. Sender-side abort deferral — a failed send from any task other than the websocket task no longer calls esp_transport_close() directly (the websocket task polls the transport with client->lock released, so a close from a sender frees the TLS context under a concurrent esp_transport_poll_read()). Senders set pending_abort; the websocket task performs the abort at the top of its locked loop, so the transport is only ever closed from the task that uses it.

  2. Destroy-from-own-task guardesp_websocket_client_destroy() previously ignored stop_wait_task() failing (which happens when called from the websocket task itself) and freed the transport/TLS context under the still-running task, which then reconnected through freed memory. It now refuses with ESP_FAIL; use esp_websocket_client_destroy_on_exit() from the websocket task instead.

Both defects manifest as PSRAM heap-poisoning corruption with CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y (mbedtls contexts in SPIRAM).


Component Registry

The esp-websocket_client component is a managed component for esp-idf that contains implementation of WebSocket protocol client for ESP32

Examples

Get started with example test example:

Documentation

About

esp_websocket_client fork with cross-task TLS teardown use-after-free fixes

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors