fix(sast): an upper-case format macro is not a non-literal format (#380) #395

Merged
sharang merged 1 commits from fix/format-macro into main 2026-09-25 11:27:23 +00:00
2 changed files with 10 additions and 1 deletions

No files matched your search

+3 -1
View File
@@ -171,9 +171,11 @@ rules:
- pattern: std::fprintf($F, $FMT, ...)
- pattern: std::sprintf($B, $FMT, ...)
- pattern: std::snprintf($B, $N, $FMT, ...)
# Not a literal, and not an upper-case macro (`#define GET_REQUEST
# "GET / HTTP/1.1"`): a macro like that expands to a literal.
- metavariable-regex:
metavariable: $FMT
regex: ^[^"]
regex: ^(?![A-Z][A-Z0-9_]*$)[^"]
- id: cra-ai-8-c-hardcoded-credential
languages: [c, cpp]
@@ -20,3 +20,10 @@ void status(const char* state) {
}
} // namespace cli
// A format macro expands to a literal: not a finding (#380).
#define STATUS_FMT "state: %s\n"
void status_line(const char* state) {
std::printf(STATUS_FMT, state);
}