]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/commitdiff
candump: Ensure than controller ID is not out of range
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 3 May 2016 11:19:48 +0000 (13:19 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 3 May 2016 11:19:48 +0000 (13:19 +0200)
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) {