Potential Buffer Overflows
- from: Jakob Nacanaynay <jnac8080@gmail.com>
- to: You <anyone@out.there>
- date: May 30, 2025, 1:58 AM
- subject: Potential Buffer Overflows
The following lines of code involve memory-unsafe functions that are vulnerable to buffer overflows:
gets(buffer);for ANY size buffer since it has no checks.scanf("%s", &buffer);again for any size buffer.strcpy(dest, src);when thedestbuffer is smaller than thesrcbuffer.
The function strncpy() can also be dangerous by not terminating long strings with a null byte.
Due to programmer error, the following functions can also be vulnerable to buffer overflows:
fgets(buffer, n, stdin);whennis larger thanbuffer. Normally, you should setntosizeof(buffer).read(fd, buffer n);again whennis larger thanbuffer.
---
~ Jakob Nacanaynay
(nack-uh-nigh-nigh)
he/him/his