Skip to content

Commit 2dc85e1

Browse files
authored
Update test.cpp
1 parent 547342c commit 2dc85e1

File tree

1 file changed

+5
-1
lines changed
  • cpp/ql/test/experimental/query-tests/Security/CWE/CWE-754/semmle/tests

1 file changed

+5
-1
lines changed

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-754/semmle/tests/test.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ int functionWork1_() {
3535
return i;
3636
}
3737

38-
int functionWork1b() {
38+
int functionWork1b(int retIndex) {
3939
int i;
4040
char a[10];
4141
int b;
4242
int *p = &b;
4343
scanf("%i", &i); // BAD
4444
scanf("%s", a); // BAD
4545
scanf("%i", p); // BAD
46+
if(retIndex == 0)
47+
return (int)a;
48+
if(retIndex == 1)
49+
return *p;
4650
return i;
4751
}
4852

0 commit comments

Comments
 (0)