From 74f72597a8b7dc4c82c2cd4991064a66170e2a8e Mon Sep 17 00:00:00 2001 From: William Kelly III Date: Wed, 31 Oct 2018 12:28:53 -0500 Subject: [PATCH] Fix off-by-one-error in BusIn/Out --- drivers/BusIn.cpp | 2 +- drivers/BusInOut.cpp | 2 +- drivers/BusOut.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/BusIn.cpp b/drivers/BusIn.cpp index f6cc933e7ea..c14351f3fe5 100644 --- a/drivers/BusIn.cpp +++ b/drivers/BusIn.cpp @@ -97,7 +97,7 @@ BusIn::operator int() DigitalIn &BusIn::operator[](int index) { // No lock needed since _pin is not modified outside the constructor - MBED_ASSERT(index >= 0 && index <= 16); + MBED_ASSERT(index >= 0 && index < 16); MBED_ASSERT(_pin[index]); return *_pin[index]; } diff --git a/drivers/BusInOut.cpp b/drivers/BusInOut.cpp index 950cbb5d58f..170e035b962 100644 --- a/drivers/BusInOut.cpp +++ b/drivers/BusInOut.cpp @@ -128,7 +128,7 @@ BusInOut &BusInOut::operator= (BusInOut &rhs) DigitalInOut &BusInOut::operator[](int index) { // No lock needed since _pin is not modified outside the constructor - MBED_ASSERT(index >= 0 && index <= 16); + MBED_ASSERT(index >= 0 && index < 16); MBED_ASSERT(_pin[index]); return *_pin[index]; } diff --git a/drivers/BusOut.cpp b/drivers/BusOut.cpp index 913ba197505..769d2e68919 100644 --- a/drivers/BusOut.cpp +++ b/drivers/BusOut.cpp @@ -95,7 +95,7 @@ BusOut &BusOut::operator= (BusOut &rhs) DigitalOut &BusOut::operator[](int index) { // No lock needed since _pin is not modified outside the constructor - MBED_ASSERT(index >= 0 && index <= 16); + MBED_ASSERT(index >= 0 && index < 16); MBED_ASSERT(_pin[index]); return *_pin[index]; }