fix(sast): an upper-case format macro is not a non-literal format (#380) #395
No files matched your search
@@ -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);
|
||||
}
|
||||
Reference in new issue
Block a user