diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 048a86c63..79f34728b 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -6717,8 +6717,11 @@ template <> otError Interpreter::Process(Arg aArgs[]) uint32_t channelMask; SuccessOrExit(error = aArgs[0].ParseAsUint8(channel)); + VerifyOrExit(channel < BitSizeOf(channelMask), error = OT_ERROR_INVALID_ARGS); + channelMask = otLinkGetSupportedChannelMask(GetInstancePtr()); VerifyOrExit((1 << channel) & channelMask, error = OT_ERROR_INVALID_ARGS); + SuccessOrExit(error = aArgs[1].ParseAsInt16(targetPower)); error = otPlatRadioSetChannelTargetPower(GetInstancePtr(), channel, targetPower);