@@ -25,9 +25,26 @@ class FunctionWithRestrictParameters extends Function {
25
25
Parameter restrictPtrParam ;
26
26
27
27
FunctionWithRestrictParameters ( ) {
28
- restrictPtrParam = this .getAParameter ( ) and
29
28
restrictPtrParam .getUnspecifiedType ( ) instanceof PointerOrArrayType and
30
- restrictPtrParam .getType ( ) .hasSpecifier ( "restrict" )
29
+ (
30
+ restrictPtrParam .getType ( ) .hasSpecifier ( [ "restrict" ] ) and
31
+ restrictPtrParam = this .getAParameter ( )
32
+ or
33
+ this .hasGlobalName ( [ "strcpy" , "strncpy" , "strcat" , "strncat" , "memcpy" ] ) and
34
+ restrictPtrParam = this .getParameter ( [ 0 , 1 ] )
35
+ or
36
+ this .hasGlobalName ( [ "strcpy_s" , "strncpy_s" , "strcat_s" , "strncat_s" , "memcpy_s" ] ) and
37
+ restrictPtrParam = this .getParameter ( [ 0 , 2 ] )
38
+ or
39
+ this .hasGlobalName ( [ "strtok_s" ] ) and
40
+ restrictPtrParam = this .getAParameter ( )
41
+ or
42
+ this .hasGlobalName ( [ "printf" , "printf_s" , "scanf" , "scanf_s" ] ) and
43
+ restrictPtrParam = this .getParameter ( 0 )
44
+ or
45
+ this .hasGlobalName ( [ "sprintf" , "sprintf_s" , "snprintf" , "snprintf_s" ] ) and
46
+ restrictPtrParam = this .getParameter ( 3 )
47
+ )
31
48
}
32
49
33
50
Parameter getARestrictPtrParam ( ) { result = restrictPtrParam }
0 commit comments