Enable checks for pointer arithmetic
Quite a few places we've disobeyed this rule, so simply ignore them for
now to avoid new issues popping up.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I3e518a8e8742279afb3ad1a9dad54006ed109fb1
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 2cd35df..a33e061 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -2009,8 +2009,11 @@
const std::string& targetID = param;
uint64_t idInt = 0;
- auto [ptr, ec] = std::from_chars(
- targetID.data(), targetID.data() + targetID.size(), idInt);
+
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+ const char* end = targetID.data() + targetID.size();
+
+ auto [ptr, ec] = std::from_chars(targetID.data(), end, idInt);
if (ec == std::errc::invalid_argument)
{
messages::resourceMissingAtURI(asyncResp->res, targetID);
@@ -3389,7 +3392,9 @@
return false;
}
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
const char* start = split[0].data() + 1;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
const char* end = split[0].data() + split[0].size();
auto [ptrIndex, ecIndex] = std::from_chars(start, end, index);
@@ -3399,6 +3404,8 @@
}
start = split[1].data();
+
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
end = split[1].data() + split[1].size();
auto [ptrValue, ecValue] = std::from_chars(start, end, currentValue);
if (ptrValue != end || ecValue != std::errc())