What is a potential risk when using the strcpy function in C?

  • Buffer overflow
  • Compilation error
  • Memory leak
  • Segmentation fault
The strcpy function in C copies a string to a destination buffer without checking the length, which can lead to buffer overflow if the source string is longer than the destination buffer. This can result in overwriting adjacent memory, causing potential security vulnerabilities or program crashes.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *