diff --git a/lib/ocpp/v16/charge_point_impl.cpp b/lib/ocpp/v16/charge_point_impl.cpp index 863678191..8f8a74868 100644 --- a/lib/ocpp/v16/charge_point_impl.cpp +++ b/lib/ocpp/v16/charge_point_impl.cpp @@ -1931,8 +1931,10 @@ void ChargePointImpl::handleRemoteStartTransactionRequest(ocpp::Call referenced_connectors; if (call.msg.connectorId) { - if (call.msg.connectorId.value() <= 0) { - EVLOG_warning << "Received RemoteStartTransactionRequest with connector id <= 0"; + if (call.msg.connectorId.value() <= 0 or + call.msg.connectorId.value() > this->configuration->getNumberOfConnectors()) { + EVLOG_warning << "Received RemoteStartTransactionRequest with connector id <= 0 or > " + << this->configuration->getNumberOfConnectors(); response.status = RemoteStartStopStatus::Rejected; ocpp::CallResult call_result(response, call.uniqueId); this->message_dispatcher->dispatch_call_result(call_result); @@ -2243,7 +2245,7 @@ void ChargePointImpl::handleUnlockConnectorRequest(ocpp::Call this->configuration->getNumberOfConnectors()) { + if (connector <= 0 or connector > this->configuration->getNumberOfConnectors()) { response.status = UnlockStatus::NotSupported; } else { // this message is not intended to remotely stop a transaction, but if a transaction is still ongoing it is @@ -2335,7 +2337,7 @@ void ChargePointImpl::handleGetCompositeScheduleRequest(ocpp::Callconfiguration->getChargingScheduleAllowedChargingRateUnitVector(); - if ((size_t)connector_id >= this->connectors.size() or connector_id < 0) { + if (connector_id > this->configuration->getNumberOfConnectors() or connector_id < 0) { response.status = GetCompositeScheduleStatus::Rejected; } else if (call.msg.chargingRateUnit and std::find(allowed_charging_rate_units.begin(), allowed_charging_rate_units.end(),