??? 02/22/09 12:31 Read: times |
#162638 - Bounds checking Responding to: ???'s previous message |
You have a variable defined:
a_type my_var[5][5];Then you iterate: for (i = 0; i < 6; i++) { for (j = 0; j < 6; j++) { } }Now a question: If your array has valid index values [0, 1, 2, 3, 4] (in total 5 values), what happens if you copy your array using a for loop taking the values [0, 1, 2, 3, 4, 5] (in total 6 values)? Hint: Define memory overwrite. Hint: Define buffer overflow. Hint: Define index-out-of-range. |