Study the following program and answer the questions. int arrayCopy(int array[], int n) { unsigned char y
Fantastic news! We've Found the answer you've been seeking!
Question:
Study the following program and answer the questions.
int arrayCopy(int array[], int n)
{
unsigned char y = n * sizeof(int);
int savedarray[y];
for(int i = 0; i < n; i++){
savedarray[i] = array[i];
}
return 0; }
1. Is there any possibility of a buffer overflow in the above program and why? For what value of n the overflow will occur, assuming sizeof(int) = 2 ?
2. If there is a buffer overflow, will it be in the Stack or Heap? Explain your answer.
Posted Date: