From: Harald Welte Date: Sat, 16 Jul 2011 15:48:20 +0000 (+0200) Subject: calypso/uart.c: Fix array bounds checking X-Git-Url: http://git.rot13.org/?p=osmocom-bb.git;a=commitdiff_plain;h=c9297d28e0484f58b4672e528610b7ba9e5aa073 calypso/uart.c: Fix array bounds checking Found by Smatch: calypso/uart.c +433 uart_baudrate(7) error: buffer overflow 'divider' 7 <= 7 --- diff --git a/src/target/firmware/calypso/uart.c b/src/target/firmware/calypso/uart.c index d3ede4d..bcb56bd 100644 --- a/src/target/firmware/calypso/uart.c +++ b/src/target/firmware/calypso/uart.c @@ -427,7 +427,7 @@ int uart_baudrate(uint8_t uart, enum uart_baudrate bdrt) { uint16_t div; - if (bdrt > ARRAY_SIZE(divider)) + if (bdrt >= ARRAY_SIZE(divider)) return -1; div = divider[bdrt];