CXX.CWARN.HARDCODED_LOOP_BOUND
Hard-coded loop used for array index.
Avoid hard-coded exit conditions in loops used for array access.
Vulnerability and risk
This can commonly lead to array overrun issues if the hard-coded exit condition is not updated when changes are made to the array size.
Mitigation and prevention
Consider using a variable and determining the exit condition from the size of the array.
Example
Copy
CArray<int, int> list;
const int ARRAY_SIZE = 52;
list.SetSize(50);
for(int i=0; i < ARRAY_SIZE; i++)
list.GetAt(i);
Attempt to access element 52 of a 50 element array.