mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 00:23:30 +00:00
The previous example wasn't reliably demonstrating the danger of missing null terminators because the stack happened to contain a '\0' byte immediately after the array, making the broken code appear to work. Added memset() to fill the stack with non-zero values before declaring the unterminated array. This ensures the broken example actually exhibits undefined behavior by reading past the array boundary, making the lesson about null terminators clear and visible. Changes: - Added garbage array filled with 'Z' characters using memset() - This forces printf() to read past the broken array until finding '\0' - Readers now see actual garbage output demonstrating why null terminators are required in C strings |
||
|---|---|---|
| .. | ||
| chapter-01.md | ||
| chapter-02.md | ||
| chapter-03.md | ||
| chapter-04.md | ||
| chapter-05.md | ||
| chapter-06.md | ||