Question: What is the issue with the following C code snippet? char buffer [ 8 ] ; strcpy ( buffer , This is a long string
What is the issue with the following C code snippet?
char buffer;
strcpybuffer "This is a long string";
The code is safe.
The strcpy function will truncate the string to fit the buffer.
The buffer size should be declared dynamically.
The string is too long for the buffer, leading to buffer overflow.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
