mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: Rearrange comments.
This commit is contained in:
@@ -8,13 +8,13 @@ import cpp
|
||||
*/
|
||||
class StrcatFunction extends Function {
|
||||
StrcatFunction() {
|
||||
// strcat(dst, src)
|
||||
// strncat(dst, src, max_amount)
|
||||
// wcscat(dst, src)
|
||||
// _mbscat(dst, src)
|
||||
// wcsncat(dst, src, max_amount)
|
||||
// _mbsncat(dst, src, max_amount)
|
||||
// _mbsncat_l(dst, src, max_amount, locale)
|
||||
getName() = ["strcat", "strncat", "wcscat", "_mbscat", "wcsncat", "_mbsncat", "_mbsncat_l"]
|
||||
getName() =
|
||||
["strcat", // strcat(dst, src)
|
||||
"strncat", // strncat(dst, src, max_amount)
|
||||
"wcscat", // wcscat(dst, src)
|
||||
"_mbscat", // _mbscat(dst, src)
|
||||
"wcsncat", // wcsncat(dst, src, max_amount)
|
||||
"_mbsncat", // _mbsncat(dst, src, max_amount)
|
||||
"_mbsncat_l"] // _mbsncat_l(dst, src, max_amount, locale)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,23 +13,21 @@ import semmle.code.cpp.models.interfaces.SideEffect
|
||||
*/
|
||||
class StrcpyFunction extends ArrayFunction, DataFlowFunction, TaintFunction, SideEffectFunction {
|
||||
StrcpyFunction() {
|
||||
// strcpy(dst, src)
|
||||
// wcscpy(dst, src)
|
||||
// _mbscpy(dst, src)
|
||||
// strncpy(dst, src, max_amount)
|
||||
// _strncpy_l(dst, src, max_amount, locale)
|
||||
// wcsncpy(dst, src, max_amount)
|
||||
// _wcsncpy_l(dst, src, max_amount, locale)
|
||||
// _mbsncpy(dst, src, max_amount)
|
||||
// _mbsncpy_l(dst, src, max_amount, locale)
|
||||
getName() =
|
||||
["strcpy", "wcscpy", "_mbscpy", "strncpy", "_strncpy_l", "wcsncpy", "_wcsncpy_l", "_mbsncpy",
|
||||
"_mbsncpy_l"]
|
||||
["strcpy", // strcpy(dst, src)
|
||||
"wcscpy", // wcscpy(dst, src)
|
||||
"_mbscpy", // _mbscpy(dst, src)
|
||||
"strncpy", // strncpy(dst, src, max_amount)
|
||||
"_strncpy_l", // _strncpy_l(dst, src, max_amount, locale)
|
||||
"wcsncpy", // wcsncpy(dst, src, max_amount)
|
||||
"_wcsncpy_l", // _wcsncpy_l(dst, src, max_amount, locale)
|
||||
"_mbsncpy", // _mbsncpy(dst, src, max_amount)
|
||||
"_mbsncpy_l"] // _mbsncpy_l(dst, src, max_amount, locale)
|
||||
or
|
||||
// strcpy_s(dst, max_amount, src)
|
||||
// wcscpy_s(dst, max_amount, src)
|
||||
// _mbscpy_s(dst, max_amount, src)
|
||||
getName() = ["strcpy_s", "wcscpy_s", "_mbscpy_s"] and
|
||||
getName() =
|
||||
["strcpy_s", // strcpy_s(dst, max_amount, src)
|
||||
"wcscpy_s", // wcscpy_s(dst, max_amount, src)
|
||||
"_mbscpy_s"] and // _mbscpy_s(dst, max_amount, src)
|
||||
// exclude the 2-parameter template versions
|
||||
// that find the size of a fixed size destination buffer.
|
||||
getNumberOfParameters() = 3
|
||||
|
||||
@@ -354,10 +354,10 @@ class SnprintfBW extends BufferWriteCall {
|
||||
*/
|
||||
class GetsBW extends BufferWriteCall {
|
||||
GetsBW() {
|
||||
// gets(dst)
|
||||
// fgets(dst, max_amount, src_stream)
|
||||
// fgetws(dst, max_amount, src_stream)
|
||||
getTarget().(TopLevelFunction).getName() = ["gets", "fgets", "fgetws"]
|
||||
getTarget().(TopLevelFunction).getName() =
|
||||
["gets", // gets(dst)
|
||||
"fgets", // fgets(dst, max_amount, src_stream)
|
||||
"fgetws"] // fgetws(dst, max_amount, src_stream)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user