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

Harden message_callback against runtime error. #885

Open
Matthias-NIDEC opened this issue Nov 27, 2024 · 0 comments
Open

Harden message_callback against runtime error. #885

Matthias-NIDEC opened this issue Nov 27, 2024 · 0 comments

Comments

@Matthias-NIDEC
Copy link
Contributor

Matthias-NIDEC commented Nov 27, 2024

OCPP Version

OCPP1.6

Describe the bug

Harden message_callback against runtime error, if the message form the backend can not be handled.
See #884

This catches set runttime_error inside ocpp/common/string.hpp
void set(const std::string& data) {
if (data.length() <= this->length) {
if (this->is_valid(data)) {
this->data = data;
} else {
throw std::runtime_error("String has invalid format");
}
} else {
throw std::runtime_error("String length (" + std::to_string(data.length()) +
") exceeds permitted length (" + std::to_string(this->length) + ")");
}
}

option would be, instead of runtime_error, cut the string.

E.g. Authorize.conf with partendId longer then 20 characters.

To Reproduce

No response

Anything else?

No response

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

No branches or pull requests

1 participant