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

Skip to content

Commit d9c6f7b

Browse files
authored
C++: Model bsl functions in Scanf.qll.
1 parent b670e5b commit d9c6f7b

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

cpp/ql/src/semmle/code/cpp/commons/Scanf.qll

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ class Scanf extends ScanfFunction {
3434
Scanf() {
3535
this instanceof TopLevelFunction and
3636
(
37-
hasName("scanf") or // scanf(format, args...)
38-
hasName("wscanf") or // wscanf(format, args...)
39-
hasName("_scanf_l") or // _scanf_l(format, locale, args...)
40-
hasName("_wscanf_l") // _wscanf_l(format, locale, args...)
37+
hasGlobalOrStdishName("scanf") or // scanf(format, args...)
38+
hasGlobalOrStdishName("wscanf") or // wscanf(format, args...)
39+
hasGlobalName("_scanf_l") or // _scanf_l(format, locale, args...)
40+
hasGlobalName("_wscanf_l") // _wscanf_l(format, locale, args...)
4141
)
4242
}
4343

@@ -53,10 +53,10 @@ class Fscanf extends ScanfFunction {
5353
Fscanf() {
5454
this instanceof TopLevelFunction and
5555
(
56-
hasName("fscanf") or // fscanf(src_stream, format, args...)
57-
hasName("fwscanf") or // fwscanf(src_stream, format, args...)
58-
hasName("_fscanf_l") or // _fscanf_l(src_stream, format, locale, args...)
59-
hasName("_fwscanf_l") // _fwscanf_l(src_stream, format, locale, args...)
56+
hasGlobalOrStdishName("fscanf") or // fscanf(src_stream, format, args...)
57+
hasGlobalOrStdishName("fwscanf") or // fwscanf(src_stream, format, args...)
58+
hasGlobalName("_fscanf_l") or // _fscanf_l(src_stream, format, locale, args...)
59+
hasGlobalName("_fwscanf_l") // _fwscanf_l(src_stream, format, locale, args...)
6060
)
6161
}
6262

@@ -72,10 +72,10 @@ class Sscanf extends ScanfFunction {
7272
Sscanf() {
7373
this instanceof TopLevelFunction and
7474
(
75-
hasName("sscanf") or // sscanf(src_stream, format, args...)
76-
hasName("swscanf") or // swscanf(src, format, args...)
77-
hasName("_sscanf_l") or // _sscanf_l(src, format, locale, args...)
78-
hasName("_swscanf_l") // _swscanf_l(src, format, locale, args...)
75+
hasGlobalOrStdishName("sscanf") or // sscanf(src_stream, format, args...)
76+
hasGlobalOrStdishName("swscanf") or // swscanf(src, format, args...)
77+
hasGlobalName("_sscanf_l") or // _sscanf_l(src, format, locale, args...)
78+
hasGlobalName("_swscanf_l") // _swscanf_l(src, format, locale, args...)
7979
)
8080
}
8181

@@ -91,10 +91,10 @@ class Snscanf extends ScanfFunction {
9191
Snscanf() {
9292
this instanceof TopLevelFunction and
9393
(
94-
hasName("_snscanf") or // _snscanf(src, max_amount, format, args...)
95-
hasName("_snwscanf") or // _snwscanf(src, max_amount, format, args...)
96-
hasName("_snscanf_l") or // _snscanf_l(src, max_amount, format, locale, args...)
97-
hasName("_snwscanf_l") // _snwscanf_l(src, max_amount, format, locale, args...)
94+
hasGlobalName("_snscanf") or // _snscanf(src, max_amount, format, args...)
95+
hasGlobalName("_snwscanf") or // _snwscanf(src, max_amount, format, args...)
96+
hasGlobalName("_snscanf_l") or // _snscanf_l(src, max_amount, format, locale, args...)
97+
hasGlobalName("_snwscanf_l") // _snwscanf_l(src, max_amount, format, locale, args...)
9898
// note that the max_amount is not a limit on the output length, it's an input length
9999
// limit used with non null-terminated strings.
100100
)

0 commit comments

Comments
 (0)