]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blobdiff - rpp-test-sw/commands/cmd_can.c
candump: Ensure than controller ID is not out of range
[pes-rpp/rpp-test-sw.git] / rpp-test-sw / commands / cmd_can.c
index f5195e94e25567b9f6b274f0cda93d4ff85e5967..f98422b50822027b9b7bdcd8430435b356ae7fab 100644 (file)
@@ -737,6 +737,11 @@ int cmd_do_can_dump(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
                return 1;
        }
 
+       if (controller_id < 1 || controller_id > 3) {
+               rpp_sci_printf("Invalid controller ID\n");
+               return -CMDERR_NODEV;
+       }
+
        rpp_can_init(&can_config);
 
        while (cmd_io->getc(cmd_io) < 0) {