Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Alternative functions that limit the number of bytes copied are often recommended to mitigate buffer overflow vulnerabilities. For example:

  • strncpy() instead of strcpy()
  • strncat() instead of strcat()
  • fgets() instead of gets()
  • snprintf() instead of sprintf()

Wiki Markup
These functions truncate strings that exceed the specified limits. Additionally, some functions such as {{strncpy()}} do not guarantee that the resulting string is null- terminated \[[STR32-C. Null- terminate byte strings as required]\].

...