about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-07-12 10:36:17 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-07-12 10:36:17 +0200
commit04988ab4ba6bcf723131d58ac60f3d9621dfe047 (patch)
tree63470bf852d35109a7967ea00adff2e128db490b
parentad41959cc6b1567a2ca5bc0613b16f0e8200dc18 (diff)
downloadprofani-tty-04988ab4ba6bcf723131d58ac60f3d9621dfe047.tar.gz
Fix segfault in /cmd exec
Test for correct number of arguments before using argument.
-rw-r--r--src/command/cmd_funcs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index e9e266c1..a6c0011f 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -7818,6 +7818,11 @@ cmd_command_exec(ProfWin *window, const char *const command, gchar **args)
         return TRUE;
     }
 
+    if (args[1] == NULL) {
+        cons_bad_cmd_usage(command);
+        return TRUE;
+    }
+
     char *jid = args[2];
     if (jid == NULL) {
         switch (window->type) {