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

Skip to content

Commit 591c17d

Browse files
committed
C++: Rearrange comments.
1 parent 488a55b commit 591c17d

3 files changed

Lines changed: 25 additions & 27 deletions

File tree

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import cpp
88
*/
99
class StrcatFunction extends Function {
1010
StrcatFunction() {
11-
// strcat(dst, src)
12-
// strncat(dst, src, max_amount)
13-
// wcscat(dst, src)
14-
// _mbscat(dst, src)
15-
// wcsncat(dst, src, max_amount)
16-
// _mbsncat(dst, src, max_amount)
17-
// _mbsncat_l(dst, src, max_amount, locale)
18-
getName() = ["strcat", "strncat", "wcscat", "_mbscat", "wcsncat", "_mbsncat", "_mbsncat_l"]
11+
getName() =
12+
["strcat", // strcat(dst, src)
13+
"strncat", // strncat(dst, src, max_amount)
14+
"wcscat", // wcscat(dst, src)
15+
"_mbscat", // _mbscat(dst, src)
16+
"wcsncat", // wcsncat(dst, src, max_amount)
17+
"_mbsncat", // _mbsncat(dst, src, max_amount)
18+
"_mbsncat_l"] // _mbsncat_l(dst, src, max_amount, locale)
1919
}
2020
}

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,21 @@ import semmle.code.cpp.models.interfaces.SideEffect
1313
*/
1414
class StrcpyFunction extends ArrayFunction, DataFlowFunction, TaintFunction, SideEffectFunction {
1515
StrcpyFunction() {
16-
// strcpy(dst, src)
17-
// wcscpy(dst, src)
18-
// _mbscpy(dst, src)
19-
// strncpy(dst, src, max_amount)
20-
// _strncpy_l(dst, src, max_amount, locale)
21-
// wcsncpy(dst, src, max_amount)
22-
// _wcsncpy_l(dst, src, max_amount, locale)
23-
// _mbsncpy(dst, src, max_amount)
24-
// _mbsncpy_l(dst, src, max_amount, locale)
2516
getName() =
26-
["strcpy", "wcscpy", "_mbscpy", "strncpy", "_strncpy_l", "wcsncpy", "_wcsncpy_l", "_mbsncpy",
27-
"_mbsncpy_l"]
17+
["strcpy", // strcpy(dst, src)
18+
"wcscpy", // wcscpy(dst, src)
19+
"_mbscpy", // _mbscpy(dst, src)
20+
"strncpy", // strncpy(dst, src, max_amount)
21+
"_strncpy_l", // _strncpy_l(dst, src, max_amount, locale)
22+
"wcsncpy", // wcsncpy(dst, src, max_amount)
23+
"_wcsncpy_l", // _wcsncpy_l(dst, src, max_amount, locale)
24+
"_mbsncpy", // _mbsncpy(dst, src, max_amount)
25+
"_mbsncpy_l"] // _mbsncpy_l(dst, src, max_amount, locale)
2826
or
29-
// strcpy_s(dst, max_amount, src)
30-
// wcscpy_s(dst, max_amount, src)
31-
// _mbscpy_s(dst, max_amount, src)
32-
getName() = ["strcpy_s", "wcscpy_s", "_mbscpy_s"] and
27+
getName() =
28+
["strcpy_s", // strcpy_s(dst, max_amount, src)
29+
"wcscpy_s", // wcscpy_s(dst, max_amount, src)
30+
"_mbscpy_s"] and // _mbscpy_s(dst, max_amount, src)
3331
// exclude the 2-parameter template versions
3432
// that find the size of a fixed size destination buffer.
3533
getNumberOfParameters() = 3

cpp/ql/src/semmle/code/cpp/security/BufferWrite.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,10 @@ class SnprintfBW extends BufferWriteCall {
354354
*/
355355
class GetsBW extends BufferWriteCall {
356356
GetsBW() {
357-
// gets(dst)
358-
// fgets(dst, max_amount, src_stream)
359-
// fgetws(dst, max_amount, src_stream)
360-
getTarget().(TopLevelFunction).getName() = ["gets", "fgets", "fgetws"]
357+
getTarget().(TopLevelFunction).getName() =
358+
["gets", // gets(dst)
359+
"fgets", // fgets(dst, max_amount, src_stream)
360+
"fgetws"] // fgetws(dst, max_amount, src_stream)
361361
}
362362

363363
/**

0 commit comments

Comments
 (0)