diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-11-10 22:18:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-10 22:18:42 +0100 |
commit | c02cd5139f4b2c7bf9ba2592fc9e0ebad3edfe88 (patch) | |
tree | 9903aa212b2980e89d1aed4ed8868b9595b2d160 | |
parent | 1808cb466bba233a00479ba944a636514c7dad89 (diff) | |
parent | e3008b71c3949c4fd8e34952ce3e4d5d8551da48 (diff) |
Merge pull request #23490 from Faless/lws_client_memfix
Fix access to freed mem in WS client after #23241
-rw-r--r-- | modules/websocket/lws_client.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/websocket/lws_client.cpp b/modules/websocket/lws_client.cpp index d71d091720..07583bb85b 100644 --- a/modules/websocket/lws_client.cpp +++ b/modules/websocket/lws_client.cpp @@ -90,12 +90,13 @@ Error LWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port, i.ssl_connection = 0; } - // This String needs to survive till we call lws_client_connect_via_info - String addr_str = (String)addr; - - i.address = addr_str.ascii().get_data(); - i.host = p_host.utf8().get_data(); - i.path = p_path.utf8().get_data(); + // These CharStrings needs to survive till we call lws_client_connect_via_info + CharString addr_ch = ((String)addr).ascii(); + CharString host_ch = p_host.utf8(); + CharString path_ch = p_path.utf8(); + i.address = addr_ch.get_data(); + i.host = host_ch.get_data(); + i.path = path_ch.get_data(); i.port = p_port; lws_client_connect_via_info(&i); |