String Safety and Buffer Overflow Prevention

Lesson overview

Topics covered: fgets vs gets, snprintf, strncpy size limits, canary values.

String Safety and Buffer Overflow Prevention

fgets(buffer, size, stream) - safe input (unlike gets)
snprintf(buffer, size, format, ...) - safe printf
strncpy(dest, src, n) - limited copy
Buffer canary values, static analysis tools

Article author: Arthur Isaev