From 555454c973107ab4c8fd39e0020bf5190342a018 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Wed, 5 Mar 2025 18:14:13 -0800 Subject: [PATCH] [cli] add validation of targetpower channel (#11326) --- src/cli/cli.cpp | 3 +++ 1 file changed, 3 insertions(+) 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);