Commit a47b303b a47b303b1a6187001cfd5bc5ec6df25d6f6ffb98 by Sergey Poznyakoff

(util_do_command): Fixed coredump on unparseable input strings.

1 parent 3fe09d98
...@@ -121,7 +121,7 @@ util_do_command (const char *c, ...) ...@@ -121,7 +121,7 @@ util_do_command (const char *c, ...)
121 return 0; 121 return 0;
122 } 122 }
123 123
124 if (argcv_get (cmd, delim, NULL, &argc, &argv) == 0) 124 if (argcv_get (cmd, delim, NULL, &argc, &argv) == 0 && argc > 0)
125 { 125 {
126 struct mail_command_entry entry; 126 struct mail_command_entry entry;
127 char *p; 127 char *p;
...@@ -152,9 +152,13 @@ util_do_command (const char *c, ...) ...@@ -152,9 +152,13 @@ util_do_command (const char *c, ...)
152 } 152 }
153 else 153 else
154 { 154 {
155 util_error (_("Unknown command: %s"), argv[0]); 155 if (argc)
156 util_error (_("Unknown command: %s"), argv[0]);
157 else
158 util_error (_("Invalid command"));
156 status = 1; 159 status = 1;
157 } 160 }
161
158 162
159 argcv_free (argc, argv); 163 argcv_free (argc, argv);
160 return status; 164 return status;
......