diff options
| author | CismonX <admin@cismon.net> | 2026-09-05 22:17:29 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2026-09-10 06:28:00 +0000 |
| commit | 96b717b7480314239736b19ae26db245385407b6 (patch) | |
| tree | 7c4b7a55e9a2b135095122071cecdf3faeec0dd4 | |
| parent | foot.ini: `color-theme-switch-1`, `color-theme-switch-2` -> `color-theme-switch-dark`, `color-theme- (diff) | |
server: fix use-after-free during shutdown
When terminal shutdown is in progress, calling client_destroy()
results in subsequent fdm_shutdown() (registered by term_shutdown())
always called with a dangling 'struct terminal' pointer.
This may happen when footclient and the client application exit
simultaneously in a short window. See #2432 for more information.
Fixed by not calling client_destroy() when terminal shutdown is
in progress. The client will eventually be destroyed in
term_shutdown_handler() (invoked from shutdown_maybe_done()),
so there's no resource leak.
| -rw-r--r-- | CHANGELOG.md | 7 | ||||
| -rw-r--r-- | server.c | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 69cf9ded..39eab318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,13 @@ ### Deprecated ### Removed ### Fixed + +* Use-after-free during shutdown when footclient and the client + application exit simultaneously in a short window ([#2432][2432]). + +[2342]: https://codeberg.org/dnkl/foot/pulls/2432 + + ### Security ### Contributors @@ -426,11 +426,9 @@ shutdown: fdm_del(fdm, fd); client->fd = -1; - if (client->instance != NULL && - !client->instance->terminal->shutdown.in_progress) - { + if (client->instance != NULL) term_shutdown(client->instance->terminal); - } else + else client_destroy(client); return true; |
