From 4634d2db0c6b586c882f2e5aa17c266c900ee85e Mon Sep 17 00:00:00 2001 From: "U. Bruhin" Date: Sat, 20 Jul 2024 11:36:06 +0200 Subject: [PATCH] fix converting authorization key to hex string --- src/MicroOcppMongooseClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MicroOcppMongooseClient.cpp b/src/MicroOcppMongooseClient.cpp index 24bdbd8..df21aa4 100644 --- a/src/MicroOcppMongooseClient.cpp +++ b/src/MicroOcppMongooseClient.cpp @@ -54,7 +54,7 @@ MOcppMongooseClient::MOcppMongooseClient(struct mg_mgr *mgr, char auth_key_hex [2 * MO_AUTHKEY_LEN_MAX + 1]; auth_key_hex[0] = '\0'; if (auth_key_factory) { - for (size_t i = 0; i < auth_key_factory_len; i += 2) { + for (size_t i = 0; i < auth_key_factory_len; i++) { snprintf(auth_key_hex + 2 * i, 3, "%02X", auth_key_factory[i]); } } @@ -357,7 +357,7 @@ void MOcppMongooseClient::setAuthKey(const unsigned char *auth_key, size_t len) char auth_key_hex [2 * MO_AUTHKEY_LEN_MAX + 1]; auth_key_hex[0] = '\0'; - for (size_t i = 0; i < len; i += 2) { + for (size_t i = 0; i < len; i++) { snprintf(auth_key_hex + 2 * i, 3, "%02X", auth_key[i]); }