Mark json_view.hpp's read() and strlen as Flawfinder false positives

json_document::read is a member function, not POSIX read(), and the C
string overload requires null-terminated input like json::parse.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-10-01 10:27:01 +02:00
parent dddb2d6e43
commit 134b2f0efe
2 changed files with 8 additions and 0 deletions

View File

@@ -329,6 +329,7 @@ class basic_json_document
/// parse into this document, reusing its memory
template<typename InputType>
// flawfinder: ignore (a member function, not POSIX read())
void read(InputType&& input,
const bool allow_exceptions = true,
const bool ignore_comments = false,
@@ -495,6 +496,8 @@ class basic_json_document
return;
}
const char* cs = reinterpret_cast<const char*>(s); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
// C strings are null-terminated, as for json::parse(const char*)
// flawfinder: ignore
build(cs, std::strlen(cs), ae, c, tc, false, true);
}