Skip to content

Commit 5549c52

Browse files
author
Cruz Monrreal
authored
Merge pull request #8606 from pea-pod/fix-bus-oboe
Fix off-by-one-error in BusIn/Out
2 parents cb49241 + 74f7259 commit 5549c52

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/BusIn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ BusIn::operator int()
9797
DigitalIn &BusIn::operator[](int index)
9898
{
9999
// No lock needed since _pin is not modified outside the constructor
100-
MBED_ASSERT(index >= 0 && index <= 16);
100+
MBED_ASSERT(index >= 0 && index < 16);
101101
MBED_ASSERT(_pin[index]);
102102
return *_pin[index];
103103
}

drivers/BusInOut.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ BusInOut &BusInOut::operator= (BusInOut &rhs)
128128
DigitalInOut &BusInOut::operator[](int index)
129129
{
130130
// No lock needed since _pin is not modified outside the constructor
131-
MBED_ASSERT(index >= 0 && index <= 16);
131+
MBED_ASSERT(index >= 0 && index < 16);
132132
MBED_ASSERT(_pin[index]);
133133
return *_pin[index];
134134
}

drivers/BusOut.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ BusOut &BusOut::operator= (BusOut &rhs)
9595
DigitalOut &BusOut::operator[](int index)
9696
{
9797
// No lock needed since _pin is not modified outside the constructor
98-
MBED_ASSERT(index >= 0 && index <= 16);
98+
MBED_ASSERT(index >= 0 && index < 16);
9999
MBED_ASSERT(_pin[index]);
100100
return *_pin[index];
101101
}

0 commit comments

Comments
 (0)