shell: add NULL pointer check

This commit is contained in:
Yasuyuki Tanaka 2018-03-22 17:38:56 +00:00
parent fb5fa58ec3
commit ecd64846a8

View File

@ -218,7 +218,10 @@ PT_THREAD(cmd_ping(struct pt *pt, shell_output_func output, char *args))
/* Get argument (remote IPv6) */
SHELL_ARGS_NEXT(args, next_args);
if(uiplib_ipaddrconv(args, &remote_addr) == 0) {
if(args == NULL) {
SHELL_OUTPUT(output, "Destination IPv6 address is not specified\n");
PT_EXIT(pt);
} else if(uiplib_ipaddrconv(args, &remote_addr) == 0) {
SHELL_OUTPUT(output, "Invalid IPv6: %s\n", args);
PT_EXIT(pt);
}