mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
C#: Restrict FormatInvalid.ql and UncontrolledFormatString.ql to calls with insertions
This commit is contained in:
@@ -14,5 +14,7 @@ import semmle.code.csharp.frameworks.Format
|
||||
import FormatFlow
|
||||
|
||||
from FormatCall s, InvalidFormatString src, PathNode source, PathNode sink
|
||||
where hasFlowPath(src, source, s, sink)
|
||||
where
|
||||
hasFlowPath(src, source, s, sink) and
|
||||
s.hasInsertions()
|
||||
select src, source, sink, "Invalid format string used in $@ formatting call.", s, "this"
|
||||
|
||||
@@ -4,6 +4,6 @@ class Bad
|
||||
{
|
||||
string GenerateEmptyClass(string c)
|
||||
{
|
||||
return string.Format("class {0} { }");
|
||||
return string.Format("class {0} { }", "C");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user