Skip to content

Commit 86cd451

Browse files
Update OcppConfig.cpp
negative values in "Interval" keys must be rejected,corrected
1 parent d442e7b commit 86cd451

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

examples/common/config/OcppConfig.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,18 +197,16 @@ ocpp::types::ConfigurationStatus OcppConfig::setConfiguration(const std::string&
197197
{
198198
if ((it->second & PARAM_WRITE) != 0)
199199
{
200-
std::size_t key_is_interval = key.find("Interval");
201-
if (key_is_interval != std::string::npos)
202-
{
203-
std::size_t value_is_negative = key.find("-");
204-
if (value_is_negative)
205-
{
206-
ret = ConfigurationStatus::Rejected;
207-
}
208-
}
200+
if (key.find("Interval") != std::string::npos)
201+
{
202+
if (value.find("-") != std::string::npos)
203+
{
204+
ret = ConfigurationStatus::Rejected;
205+
}
206+
}
209207

210-
if (ret != ConfigurationStatus::Rejected)
211-
{
208+
if (ret != ConfigurationStatus::Rejected)
209+
{
212210
if ((it->second & PARAM_OCPP) != 0)
213211
{
214212
m_config.set(OCPP_PARAMS, key, value);
@@ -225,7 +223,7 @@ ocpp::types::ConfigurationStatus OcppConfig::setConfiguration(const std::string&
225223
{
226224
ret = ConfigurationStatus::Accepted;
227225
}
228-
}
226+
}
229227
}
230228
else
231229
{

0 commit comments

Comments
 (0)