Question: Q2. 20pts [Exercise 17.1] Consider the buffer overflow vulnerability in the code below: 1: char sensor_data[16]; 2: int secret_key; 3: void read sensor_data () {
![Q2. 20pts [Exercise 17.1] Consider the buffer overflow vulnerability in the](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4501f3db1d_32666f4501ea11a2.jpg)
Q2. 20pts [Exercise 17.1] Consider the buffer overflow vulnerability in the code below: 1: char sensor_data[16]; 2: int secret_key; 3: void read sensor_data () { 4: int i = 0; 5: // more_date returns 1 if there is more data, and 0 otherwise 6: while (more_date()) { 7: sensor_data[i] = get_next_byte(); 8: i++; 9: } 10: return; 11: } Modify the code so as to prevent the buffer overflow, or explain in a few sentences how you can prevent the buffer overflow caused by this code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
