diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 478ac5c49..88e0d196c 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -2120,6 +2120,8 @@ otError Interpreter::ProcessPrefixAdd(int argc, char *argv[]) otBorderRouterConfig config; int argcur = 0; + VerifyOrExit(argc > 0, error = OT_ERROR_INVALID_ARGS); + memset(&config, 0, sizeof(otBorderRouterConfig)); char *prefixLengthStr; @@ -2212,6 +2214,8 @@ otError Interpreter::ProcessPrefixRemove(int argc, char *argv[]) struct otIp6Prefix prefix; int argcur = 0; + VerifyOrExit(argc > 0, error = OT_ERROR_INVALID_ARGS); + memset(&prefix, 0, sizeof(otIp6Prefix)); char *prefixLengthStr;