diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-07-01 16:10:27 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-07-01 16:10:27 +0200 |
commit | 780ee74177d00eabb152ee85d2b4a24cba48df9b (patch) | |
tree | 151c12b50a6ed3392403c4e15f337dd77c6cacb6 /src/command | |
parent | 8be1e44cea64ca8bebfea38fb37641ea6bae60b7 (diff) | |
download | profani-tty-780ee74177d00eabb152ee85d2b4a24cba48df9b.tar.gz |
cmd_executable(): Check arg lengths
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/cmd_funcs.c | 10 |
1 files changed, 10 insertions, 0 deletions
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]); |