summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/event/stream.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-04-25 20:07:22 +0800
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2026-04-25 12:38:20 +0000
commitf0baa1804384b96a03d6c0ed637f7b543f03ff5c (patch)
treee3c12e627e6a361f4ac266544240062759e4b92d /src/nvim/event/stream.c
parente5114d03b589511e5ce8c47d8e9de62b45a583e4 (diff)
fix(channel): stack-buffer-overflow with exit during connection (#39387)release-0.12
Problem: When Nvim exits while connecting to a socket it leads to stack-buffer-overflow. Solution: Associate the handle with the Stream and use the Stream's internal_close_cb to update the "closed" status. (cherry picked from commit 4ed2e66d2ec20c2bf0325283b0e785ca3abb15c0)
Diffstat (limited to 'src/nvim/event/stream.c')
-rw-r--r--src/nvim/event/stream.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c
index 24bf8b5fe4..be3120a196 100644
--- a/src/nvim/event/stream.c
+++ b/src/nvim/event/stream.c
@@ -143,8 +143,8 @@ void stream_close_handle(Stream *stream)
static void close_cb(uv_handle_t *handle)
{
Stream *stream = handle->data;
- // Need to check if handle->data is NULL here as this callback may be called between
- // the handle's initialization and stream_init() (e.g. in socket_connect()).
+ // Check if handle->data is NULL here, in case this callback is called between
+ // the handle's initialization and stream_init().
if (stream && stream->close_cb) {
stream->close_cb(stream, stream->close_cb_data);
}