File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
cpp/ql/test/experimental/query-tests/Security/CWE/CWE-754/semmle/tests Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ int functionWork1(int retIndex) {
15
15
if (scanf (" %i" , p) != 1 ) // GOOD
16
16
return -1 ;
17
17
if (retIndex == 0 )
18
- return (int )a;
18
+ return (int )* a;
19
19
if (retIndex == 1 )
20
20
return *p;
21
21
return i;
@@ -37,7 +37,7 @@ int functionWork1_(int retIndex) {
37
37
if (r != 1 ) // GOOD
38
38
return -1 ;
39
39
if (retIndex == 0 )
40
- return (int )a;
40
+ return (int )* a;
41
41
if (retIndex == 1 )
42
42
return *p;
43
43
return i;
@@ -52,14 +52,14 @@ int functionWork1b(int retIndex) {
52
52
scanf (" %s" , a); // BAD
53
53
scanf (" %i" , p); // BAD
54
54
if (retIndex == 0 )
55
- return (int )a;
55
+ return (int )* a;
56
56
if (retIndex == 1 )
57
57
return *p;
58
58
return i;
59
59
}
60
60
int functionWork1_ () {
61
61
int i;
62
- scanf (" %i" ,&i);
62
+ scanf (" %i" ,&i); // GOOD
63
63
if (i<10 )
64
64
return -1 ;
65
65
return i;
@@ -73,7 +73,7 @@ int functionWork2(int retIndex) {
73
73
scanf (" %s" , a); // GOOD:Argument initialized even when scanf fails.
74
74
scanf (" %i" , p); // GOOD:Argument initialized even when scanf fails.
75
75
if (retIndex == 0 )
76
- return (int )a;
76
+ return (int )* a;
77
77
if (retIndex == 1 )
78
78
return *p;
79
79
return i;
@@ -91,7 +91,7 @@ int functionWork2_(int retIndex) {
91
91
scanf (" %s" , a); // GOOD:Argument initialized even when scanf fails.
92
92
scanf (" %i" , p); // GOOD:Argument initialized even when scanf fails.
93
93
if (retIndex == 0 )
94
- return (int )a;
94
+ return (int )* a;
95
95
if (retIndex == 1 )
96
96
return *p;
97
97
return i;
You can’t perform that action at this time.
0 commit comments