From 6b976f22cf53fc7e6c85d0415107935edd9f0798 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 17 Dec 2020 13:44:49 +0100 Subject: [PATCH] incomplete changeDevice --- cube/User/Src/configCmds.c | 7 +++++++ 1 file changed, 7 insertions(+) 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);