@@ -4,16 +4,19 @@ import semmle.code.cpp.models.interfaces.Taint
44
55
66/**
7- * The standard function `stract ` and its wide, sized, and Microsoft variants.
7+ * The standard function `strcpy ` and its wide, sized, and Microsoft variants.
88 */
99class StrcpyFunction extends ArrayFunction , DataFlowFunction , TaintFunction {
1010 StrcpyFunction ( ) {
1111 this .hasName ( "strcpy" ) or
1212 this .hasName ( "_mbscpy" ) or
1313 this .hasName ( "wcscpy" ) or
1414 this .hasName ( "strncpy" ) or
15+ this .hasName ( "_strncpy_l" ) or
1516 this .hasName ( "_mbsncpy" ) or
16- this .hasName ( "wcsncpy" )
17+ this .hasName ( "_mbsncpy_l" ) or
18+ this .hasName ( "wcsncpy" ) or
19+ this .hasName ( "_wcsncpy_l" )
1720 }
1821
1922 override predicate hasArrayInput ( int bufParam ) {
@@ -31,13 +34,16 @@ class StrcpyFunction extends ArrayFunction, DataFlowFunction, TaintFunction {
3134 override predicate hasArrayWithVariableSize ( int bufParam , int countParam ) {
3235 (
3336 this .hasName ( "strncpy" ) or
37+ this .hasName ( "_strncpy_l" ) or
3438 this .hasName ( "_mbsncpy" ) or
35- this .hasName ( "wcsncpy" )
39+ this .hasName ( "_mbsncpy_l" ) or
40+ this .hasName ( "wcsncpy" ) or
41+ this .hasName ( "_wcsncpy_l" )
3642 ) and
3743 bufParam = 0 and
3844 countParam = 2
3945 }
40-
46+
4147 override predicate hasArrayWithUnknownSize ( int bufParam ) {
4248 (
4349 this .hasName ( "strcpy" ) or
@@ -46,7 +52,6 @@ class StrcpyFunction extends ArrayFunction, DataFlowFunction, TaintFunction {
4652 ) and
4753 bufParam = 0
4854 }
49-
5055
5156 override predicate hasDataFlow ( FunctionInput input , FunctionOutput output ) {
5257 (
@@ -70,14 +75,17 @@ class StrcpyFunction extends ArrayFunction, DataFlowFunction, TaintFunction {
7075 output .isOutReturnValue ( )
7176 )
7277 }
73-
78+
7479 override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
7580 (
7681 // these may do only a partial copy of the input buffer to the output
7782 // buffer
7883 this .hasName ( "strncpy" ) or
84+ this .hasName ( "_strncpy_l" ) or
7985 this .hasName ( "_mbsncpy" ) or
80- this .hasName ( "wcsncpy" )
86+ this .hasName ( "_mbsncpy_l" ) or
87+ this .hasName ( "wcsncpy" ) or
88+ this .hasName ( "_wcsncpy_l" )
8189 ) and (
8290 input .isInParameter ( 2 ) or
8391 input .isInParameterPointer ( 1 )
0 commit comments