fix out-of-bounds read
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-04-21 10:25:51 +02:00
parent 23730349b0
commit 9c54696d91
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -81,13 +81,17 @@ ReturnValue_t PCDUHandler::initialize() {
void PCDUHandler::initializeSwitchStates() { void PCDUHandler::initializeSwitchStates() {
using namespace pcdu; using namespace pcdu;
try {
for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) { for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) {
if (idx < PDU::CHANNELS_LEN) { if (idx < PDU::CHANNELS_LEN) {
switchStates[idx] = INIT_SWITCHES_PDU1[idx]; switchStates[idx] = INIT_SWITCHES_PDU1.at(idx);
} else { } else {
switchStates[idx] = INIT_SWITCHES_PDU2[idx]; 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;
}
} }
void PCDUHandler::readCommandQueue() { void PCDUHandler::readCommandQueue() {