From 3b0e8861935059ae79a0c37ad5e8c349628b32f4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 24 Jan 2017 12:39:39 +0100 Subject: command: fix potential crash for script-binding with multi-commands "show-text test; script-binding display_stats" can potentially crash. It sends a message event. None of the string arguments can be NULL, which fails if cmd->key_name is NULL. This in turn can be due to commands combined with ";" (basically the key association doesn't consider nested commands). --- player/command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 0c5b3fa21b..6e7389d666 100644 --- a/player/command.c +++ b/player/command.c @@ -5354,7 +5354,8 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re if (cmd->is_up_down) state[0] = cmd->repeated ? 'r' : (cmd->is_up ? 'u' : 'd'); event.num_args = 4; - event.args = (const char*[4]){"key-binding", name, state, cmd->key_name}; + event.args = (const char*[4]){"key-binding", name, state, + cmd->key_name ? cmd->key_name : ""}; if (mp_client_send_event_dup(mpctx, target, MPV_EVENT_CLIENT_MESSAGE, &event) < 0) { -- cgit v1.2.3