fix out-of-bounds read
This commit is contained in:
parent
23730349b0
commit
9c54696d91
@ -81,12 +81,16 @@ ReturnValue_t PCDUHandler::initialize() {
|
|||||||
|
|
||||||
void PCDUHandler::initializeSwitchStates() {
|
void PCDUHandler::initializeSwitchStates() {
|
||||||
using namespace pcdu;
|
using namespace pcdu;
|
||||||
for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) {
|
try {
|
||||||
if (idx < PDU::CHANNELS_LEN) {
|
for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) {
|
||||||
switchStates[idx] = INIT_SWITCHES_PDU1[idx];
|
if (idx < PDU::CHANNELS_LEN) {
|
||||||
} else {
|
switchStates[idx] = INIT_SWITCHES_PDU1.at(idx);
|
||||||
switchStates[idx] = INIT_SWITCHES_PDU2[idx];
|
} else {
|
||||||
|
switchStates[idx] = INIT_SWITCHES_PDU2.at(idx - PDU::CHANNELS_LEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (const std::out_of_range& err) {
|
||||||
|
sif::error << "PCDUHandler::initializeSwitchStates: " << err.what() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user