From 3ebae8dd1bb4e1edb2df149470c544a705e15bbd Mon Sep 17 00:00:00 2001 From: Cristian Recoseanu Date: Wed, 2 Aug 2023 17:00:50 +0100 Subject: [PATCH] Update mock to cope with handles outside the allowed range --- code/src/NCModel/Blocks.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/code/src/NCModel/Blocks.ts b/code/src/NCModel/Blocks.ts index 3bb05c7..dce2a42 100644 --- a/code/src/NCModel/Blocks.ts +++ b/code/src/NCModel/Blocks.ts @@ -583,8 +583,17 @@ export class RootBlock extends NcBlock } else { - socket.send(this.ProcessCommand(msgCommand, socket).ToJson()); - isMessageValid = true; + let invalidCommands = msgCommand.commands.filter(x => x.handle <= 0 || x.handle > 65535); + if(invalidCommands.length > 0) + { + isMessageValid = false; + errorMessage = `One of the commands has an invalid handle`; + } + else + { + socket.send(this.ProcessCommand(msgCommand, socket).ToJson()); + isMessageValid = true; + } } } break;