Skip to content

Commit 62699e7

Browse files
committed
VCT: Validate the srcVC before indexing the virtualCircuitList
1 parent 31e4028 commit 62699e7

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

Firmware/Tools/VcServerTest.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,27 @@ void radioCommandComplete(VC_SERIAL_MESSAGE_HEADER * header, uint8_t * data, uin
686686
//The command processor is still running
687687
commandProcessorRunning = STALL_CHECK_COUNT;
688688

689-
//Done with this command
689+
//Validate the srcVc
690690
srcVc = header->radio.srcVc;
691+
if (srcVc >= PC_REMOTE_COMMAND)
692+
{
693+
if (srcVc < (uint8_t)VC_RSVD_SPECIAL_VCS)
694+
srcVc &= VCAB_NUMBER_MASK;
695+
else
696+
switch(srcVc)
697+
{
698+
default:
699+
fprintf(stderr, "ERROR: Unknown VC: %d (0x%02x)\n", srcVc, srcVc);
700+
exit(-2);
701+
break;
702+
703+
//Ignore this command
704+
case (uint8_t)VC_UNASSIGNED:
705+
return;
706+
}
707+
}
708+
709+
//Done with this command
691710
if (srcVc == myVc)
692711
{
693712
if (pcActiveCommand < CMD_LIST_SIZE)

0 commit comments

Comments
 (0)