Added additional checks for NULL pointers in execute_line().
Test-Parameters: trivial
Signed-off-by: Frank Sehr <fsehr@whamcloud.com>
Change-Id: I0e470edadd3b4db4c47f0f42f52d34d541290224
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58468
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Manish Regmi <mregmi@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
fprintf(stderr, "No such command. Try --list-commands to see available commands.\n");
break;
case CMD_INCOMPLETE:
+ if (cmd == NULL || cmd->pc_sub_cmd == NULL) {
+ fprintf(stderr, "'%s' incomplete command.\n", line);
+ return rc;
+ }
+
fprintf(stderr,
- "'%s' incomplete command. Use '%s x' where x is one of:\n",
+ "'%s' incomplete command. Use '%s x' where x is one of:\n\t",
line, line);
- fprintf(stderr, "\t");
+
for (i = 0; cmd->pc_sub_cmd[i].pc_name; i++)
fprintf(stderr, "%s ", cmd->pc_sub_cmd[i].pc_name);
+
fprintf(stderr, "\n");
break;
case CMD_COMPLETE: