Skip to content

Commit

Permalink
Suppress cppcheck false positive, as copy of string is required to av…
Browse files Browse the repository at this point in the history
…oid use after free
  • Loading branch information
eduar-hte committed May 4, 2024
1 parent 361d10a commit 81a86d2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/modsecurity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,10 @@ int ModSecurity::processContentOffset(const char *content, size_t len,
std::string value;
yajl_gen_map_open(g);
vars.pop_back();
// cppcheck-suppress redundantCopyLocalConst ; copy required to avoid use after free, see commit 7cb67b0
const std::string startingAt = vars.back().str();
vars.pop_back();
// cppcheck-suppress redundantCopyLocalConst ; copy required to avoid use after free, see commit 7cb67b0
const std::string size = vars.back().str();
vars.pop_back();
yajl_gen_string(g,
Expand Down Expand Up @@ -346,8 +348,10 @@ int ModSecurity::processContentOffset(const char *content, size_t len,
strlen("highlight"));
yajl_gen_map_open(g);
ops.pop_back();
// cppcheck-suppress redundantCopyLocalConst ; copy required to avoid use after free, see commit 7cb67b0
const std::string startingAt = ops.back().str();
ops.pop_back();
// cppcheck-suppress redundantCopyLocalConst ; copy required to avoid use after free, see commit 7cb67b0
const std::string size = ops.back().str();
ops.pop_back();
yajl_gen_string(g,
Expand Down

0 comments on commit 81a86d2

Please sign in to comment.