mirror of
https://github.com/github/codeql.git
synced 2025-12-24 20:56:33 +01:00
12 lines
264 B
C++
12 lines
264 B
C++
Record records[SIZE] = ...;
|
|
|
|
int f() {
|
|
int recordIdx = 0;
|
|
cin >> recordIdx;
|
|
printRecord(&(records[recordIdx])); //incorrect: recordIdx may be negative here
|
|
|
|
if (recordIdx >= 0) {
|
|
processRecord(&(records[recordIdx])); //correct: index checked before use
|
|
}
|
|
}
|