diff --git a/cube/User/Src/configCmds.c b/cube/User/Src/configCmds.c index 60d29cd..6cb8233 100644 --- a/cube/User/Src/configCmds.c +++ b/cube/User/Src/configCmds.c @@ -221,6 +221,13 @@ static bool changeDeviceCmd(uint8_t argc, char **args) { return makeDevice(0, argc, args, NULL); } + long int rawIndex = strtol(args[1], NULL, 10); + if (rawIndex < 0 || rawIndex > getConfig()->numOfDeviceBlocks) { + sendFormatString("illegal index, must be greater 0 and less %d\n\r", getConfig()->numOfDeviceBlocks); + return false; + } + uint8_t index = (uint8_t) rawIndex; + t_deviceBlock deviceBlock; uint8_t index; bool retCode = makeDevice(1, argc, args, &deviceBlock);