C++: Address review.

This commit is contained in:
Cornelius Riemenschneider
2021-02-16 11:49:44 +00:00
committed by GitHub
parent c9af97b742
commit 5dc57e9cc2
2 changed files with 6 additions and 6 deletions

View File

@@ -142,9 +142,9 @@ class Declaration extends Locatable, @declaration {
/**
* Holds if this declaration has the given name in the global namespace,
* the `std` namespace or the `bsl` namespace.
* We treat `std` and `bsl` as the same in a bunch of our models.
* We treat `std` and `bsl` as the same in some of our models.
*/
predicate hasGlobalOrStdishName(string name) {
predicate hasGlobalOrStdOrBslName(string name) {
this.hasGlobalName(name)
or
this.hasQualifiedName("std", "", name)

View File

@@ -7,7 +7,7 @@ import semmle.code.cpp.models.interfaces.SideEffect
private class PureStrFunction extends AliasFunction, ArrayFunction, TaintFunction,
SideEffectFunction {
PureStrFunction() {
hasGlobalOrStdishName([
hasGlobalOrStdOrBslName([
atoi(), "strcasestr", "strchnul", "strchr", "strchrnul", "strstr", "strpbrk", "strrchr",
"strspn", strtol(), strrev(), strcmp(), strlwr(), strupr()
])
@@ -92,7 +92,7 @@ private string strcmp() {
/** String standard `strlen` function, and related functions for computing string lengths. */
private class StrLenFunction extends AliasFunction, ArrayFunction, SideEffectFunction {
StrLenFunction() {
hasGlobalOrStdishName(["strlen", "strnlen", "wcslen"])
hasGlobalOrStdOrBslName(["strlen", "strnlen", "wcslen"])
or
hasGlobalName(["_mbslen", "_mbslen_l", "_mbstrlen", "_mbstrlen_l"])
}
@@ -125,7 +125,7 @@ private class StrLenFunction extends AliasFunction, ArrayFunction, SideEffectFun
/** Pure functions. */
private class PureFunction extends TaintFunction, SideEffectFunction {
PureFunction() { hasGlobalOrStdishName(["abs", "labs"]) }
PureFunction() { hasGlobalOrStdOrBslName(["abs", "labs"]) }
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
exists(ParameterIndex i |
@@ -144,7 +144,7 @@ private class PureFunction extends TaintFunction, SideEffectFunction {
private class PureMemFunction extends AliasFunction, ArrayFunction, TaintFunction,
SideEffectFunction {
PureMemFunction() {
hasGlobalOrStdishName([
hasGlobalOrStdOrBslName([
"memchr", "__builtin_memchr", "memrchr", "rawmemchr", "memcmp", "__builtin_memcmp", "memmem"
]) or
this.hasGlobalName("memfrob")