summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/async_resolve.hpp1
-rw-r--r--include/ibm/locks.hpp11
-rw-r--r--include/json_html_serializer.hpp3
-rw-r--r--include/multipart_parser.hpp14
-rw-r--r--include/pam_authenticate.hpp2
5 files changed, 26 insertions, 5 deletions
diff --git a/include/async_resolve.hpp b/include/async_resolve.hpp
index c69fd87129..0945001537 100644
--- a/include/async_resolve.hpp
+++ b/include/async_resolve.hpp
@@ -80,6 +80,7 @@ class Resolver
}
uint16_t portNum = 0;
auto it = std::from_chars(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
port.data(), port.data() + port.size(), portNum);
if (it.ec != std::errc())
{
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 4fbb50360d..5a86d09dec 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -535,9 +535,14 @@ inline bool Lock::checkByte(uint64_t resourceId1, uint64_t resourceId2,
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
uint8_t* q = reinterpret_cast<uint8_t*>(&resourceId2);
- BMCWEB_LOG_DEBUG << "Comparing bytes " << std::to_string(p[position]) << ","
- << std::to_string(q[position]);
- if (p[position] != q[position])
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+ uint8_t pPosition = p[position];
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+ uint8_t qPosition = q[position];
+
+ BMCWEB_LOG_DEBUG << "Comparing bytes " << std::to_string(pPosition) << ","
+ << std::to_string(qPosition);
+ if (pPosition != qPosition)
{
return false;
}
diff --git a/include/json_html_serializer.hpp b/include/json_html_serializer.hpp
index 3efc224444..4969d27278 100644
--- a/include/json_html_serializer.hpp
+++ b/include/json_html_serializer.hpp
@@ -353,6 +353,7 @@ void dumpInteger(std::string& out, NumberType number)
// jump to the end to generate the string from backward
// so we later avoid reversing the result
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
bufferPtr += nChars;
// Fast int2ascii implementation inspired by "Fastware" talk by Andrei
@@ -384,6 +385,8 @@ inline void dumpfloat(std::string& out, double number,
{
std::array<char, 64> numberbuffer{{}};
char* begin = numberbuffer.data();
+
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
::nlohmann::detail::to_chars(begin, begin + numberbuffer.size(), number);
out += begin;
diff --git a/include/multipart_parser.hpp b/include/multipart_parser.hpp
index 3728311fbe..e385558037 100644
--- a/include/multipart_parser.hpp
+++ b/include/multipart_parser.hpp
@@ -79,6 +79,7 @@ class MultipartParser
for (size_t i = 0; i < len; i++)
{
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
char c = buffer[i];
switch (state)
{
@@ -139,6 +140,8 @@ class MultipartParser
{
return ParserError::ERROR_EMPTY_HEADER;
}
+
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
currentHeaderName.append(buffer + headerFieldMark,
i - headerFieldMark);
state = State::HEADER_VALUE_START;
@@ -161,6 +164,7 @@ class MultipartParser
case State::HEADER_VALUE:
if (c == cr)
{
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
std::string_view value(buffer + headerValueMark,
i - headerValueMark);
mime_fields.rbegin()->fields.set(currentHeaderName,
@@ -190,6 +194,8 @@ class MultipartParser
if (index == 0)
{
skipNonBoundary(buffer, len, boundary.size() - 1, i);
+
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
c = buffer[i];
}
processPartData(prevIndex, index, buffer, i, c, state);
@@ -229,6 +235,7 @@ class MultipartParser
// boyer-moore derived algorithm to safely skip non-boundary data
while (i + boundary.size() <= len)
{
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
if (isBoundaryChar(buffer[i + boundaryEnd]))
{
break;
@@ -248,8 +255,11 @@ class MultipartParser
{
if (index == 0)
{
- mime_fields.rbegin()->content += std::string_view(
- buffer + partDataMark, i - partDataMark);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+ const char* start = buffer + partDataMark;
+ size_t size = i - partDataMark;
+ mime_fields.rbegin()->content +=
+ std::string_view(start, size);
}
index++;
}
diff --git a/include/pam_authenticate.hpp b/include/pam_authenticate.hpp
index 0ce0bb4a84..1459ea6112 100644
--- a/include/pam_authenticate.hpp
+++ b/include/pam_authenticate.hpp
@@ -24,6 +24,7 @@ inline int pamFunctionConversation(int numMsg, const struct pam_message** msg,
for (int i = 0; i < numMsg; ++i)
{
/* Ignore all PAM messages except prompting for hidden input */
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
if (msg[i]->msg_style != PAM_PROMPT_ECHO_OFF)
{
continue;
@@ -66,6 +67,7 @@ inline int pamFunctionConversation(int numMsg, const struct pam_message** msg,
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
*resp = reinterpret_cast<pam_response*>(ptr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
resp[i]->resp = pass;
return PAM_SUCCESS;