From 780ee74177d00eabb152ee85d2b4a24cba48df9b Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 1 Jul 2020 16:10:27 +0200 Subject: cmd_executable(): Check arg lengths --- src/command/cmd_funcs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/command') diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index b7a6dec3..ed20d09d 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -9156,12 +9156,22 @@ cmd_executable(ProfWin *window, const char *const command, gchar **args) prefs_set_string(PREF_AVATAR_CMD, args[1]); cons_show("Avatar command set to: %s", args[1]); } else if (g_strcmp0(args[0], "urlopen") == 0) { + if (g_strv_length(args) < 4) { + cons_bad_cmd_usage(command); + return TRUE; + } + char *str = g_strjoinv(" ", &args[3]); const gchar* const list[] = {args[2], str, NULL}; prefs_set_string_list_with_option(PREF_URL_OPEN_CMD, args[1], list); cons_show("`url open` command set to: %s for %s files", str, args[1]); g_free(str); } else if (g_strcmp0(args[0], "urlsave") == 0) { + if (g_strv_length(args) < 3) { + cons_bad_cmd_usage(command); + return TRUE; + } + char *str = g_strjoinv(" ", &args[2]); prefs_set_string_with_option(PREF_URL_SAVE_CMD, args[1], str); cons_show("`url save` command set to: %s for scheme %s", str, args[1]); -- cgit 1.4.1-2-gfad0