mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
C++: respond to more PR comments
This commit is contained in:
@@ -34,10 +34,10 @@ class FileFunction extends FunctionWithWrappers {
|
||||
nme.matches("CreateFile%")
|
||||
)
|
||||
or
|
||||
this.hasStdName("fopen")
|
||||
this.hasQualifiedName("std", "fopen")
|
||||
or
|
||||
// on any of the fstream classes, or filebuf
|
||||
exists(string nme | this.getDeclaringType().hasStdName(nme) |
|
||||
exists(string nme | this.getDeclaringType().hasQualifiedName("std", nme) |
|
||||
nme = "basic_fstream" or
|
||||
nme = "basic_ifstream" or
|
||||
nme = "basic_ofstream" or
|
||||
|
||||
@@ -119,17 +119,11 @@ abstract class Declaration extends Locatable, @declaration {
|
||||
/** Holds if this declaration has the given name in the global namespace. */
|
||||
predicate hasGlobalName(string name) { this.hasQualifiedName("", "", name) }
|
||||
|
||||
|
||||
/** Holds if this declaration has the given name in the `std` namespace. */
|
||||
predicate hasStdName(string name) {
|
||||
this.hasQualifiedName("std", "", name)
|
||||
}
|
||||
|
||||
/** Holds if this declaration has the given name in the global namespace or the `std` namespace. */
|
||||
predicate hasGlobalOrStdName(string name) {
|
||||
this.hasGlobalName(name)
|
||||
or
|
||||
this.hasStdName(name)
|
||||
this.hasQualifiedName("std", "", name)
|
||||
}
|
||||
|
||||
/** Gets a specifier of this declaration. */
|
||||
|
||||
@@ -6,7 +6,7 @@ import cpp
|
||||
predicate fopenCall(FunctionCall fc) {
|
||||
exists(Function f | f = fc.getTarget() |
|
||||
f.hasGlobalOrStdName("fopen") or
|
||||
f.hasGlobalOrStdName("open") or
|
||||
f.hasGlobalName("open") or
|
||||
f.hasGlobalName("_open") or
|
||||
f.hasGlobalName("_wopen") or
|
||||
f.hasGlobalName("CreateFile") or
|
||||
|
||||
Reference in New Issue
Block a user