From a32dbbfe0d6366c059916dbbb59c38f95fd623e4 Mon Sep 17 00:00:00 2001 From: krzysztof-cabaj Date: Thu, 26 Oct 2023 18:08:33 +0200 Subject: [PATCH] tests/drivers/at: fix device table overflow --- tests/drivers/at/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/drivers/at/main.c b/tests/drivers/at/main.c index f524c256dc..4313700423 100644 --- a/tests/drivers/at/main.c +++ b/tests/drivers/at/main.c @@ -47,6 +47,11 @@ static int init(int argc, char **argv) uint8_t uart = atoi(argv[1]); uint32_t baudrate = atoi(argv[2]); + if (uart >= UART_NUMOF) { + printf("Wrong UART device number - should be in range 0-%d.\n", UART_NUMOF - 1); + return 1; + } + int res = at_dev_init(&at_dev, UART_DEV(uart), baudrate, buf, sizeof(buf)); /* check the UART initialization return value and respond as needed */