Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bounds check of connectors when validating charging profile #925

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Pietfried
Copy link
Contributor

@Pietfried Pietfried commented Dec 23, 2024

Describe your changes

Issue ticket number and link

Checklist before requesting a review

Signed-off-by: Piet Gömpel <[email protected]>
@@ -166,7 +166,7 @@ bool SmartChargingHandler::validate_profile(
ChargingProfile& profile, const int connector_id, bool ignore_no_transaction, const int profile_max_stack_level,
const int max_charging_profiles_installed, const int charging_schedule_max_periods,
const std::vector<ChargingRateUnit>& charging_schedule_allowed_charging_rate_units) {
if ((size_t)connector_id > this->connectors.size() or connector_id < 0 or profile.stackLevel < 0 or
if ((size_t)connector_id >= this->connectors.size() or connector_id < 0 or profile.stackLevel < 0 or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general we should probably use static_cast here instead of using a c-style cast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants