Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3604557

Browse files
committed
C++: Remove linear scan in isSVariant.
1 parent 39977e9 commit 3604557

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

  • cpp/ql/src/semmle/code/cpp/models/implementations

cpp/ql/src/semmle/code/cpp/models/implementations/Strcpy.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ class StrcpyFunction extends ArrayFunction, DataFlowFunction, TaintFunction, Sid
4040
/**
4141
* Holds if this is one of the `strcpy_s` variants.
4242
*/
43-
private predicate isSVariant() {
44-
exists(string name | name = getName() | name.suffix(name.length() - 2) = "_s")
45-
}
43+
private predicate isSVariant() { getName().matches("%\\_s") }
4644

4745
/**
4846
* Gets the index of the parameter that is the maximum size of the copy (in characters).

0 commit comments

Comments
 (0)