Skip to content

Commit fa3ce61

Browse files
authored
Update test.cpp
1 parent 4b451cf commit fa3ce61

File tree

1 file changed

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

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,10 @@ int functionWork3b(int i) {
119119
scanf("%i", &i); // BAD
120120
return 0;
121121
}
122+
int functionWork3() {
123+
char number[] = "42";
124+
int d;
125+
sscanf(number, "%d", &d); // GOOD: sscanf always succeeds
126+
if (d < 16)
127+
return -1;
128+
}

0 commit comments

Comments
 (0)