aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-12 17:33:18 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-12 17:33:18 +0000
commit9e49ec6cd325bf521f63450f3f87525cb82c63a9 (patch)
tree4cf932e9c428397f629bc82c9f136ded16ac006d /server.c
parent22d51ec1ead8077f9528727db56e54e997da1775 (diff)
downloadrtmux-9e49ec6cd325bf521f63450f3f87525cb82c63a9.tar.gz
rtmux-9e49ec6cd325bf521f63450f3f87525cb82c63a9.tar.bz2
rtmux-9e49ec6cd325bf521f63450f3f87525cb82c63a9.zip
Creating a key binding which replaces itself (such as "bind x bind x lsw")
frees the command list bound to the key while it is still being executed, leading to a use after free. To prevent this, create a dead keys list and defer freeing replaced or removed key bindings until the main loop when the key binding will have finished executing. Found by Johan Friis when creating a key binding to reload his configuration file.
Diffstat (limited to 'server.c')
-rw-r--r--server.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/server.c b/server.c
index e9986a72..71b619ae 100644
--- a/server.c
+++ b/server.c
@@ -346,6 +346,9 @@ server_main(int srv_fd)
server_handle_windows(&pfd);
server_handle_clients(&pfd);
+ /* Collect any unset key bindings. */
+ key_bindings_clean();
+
/*
* If we have no sessions and clients left, let's get out
* of here...