CY.II · CySA+ CS0-004 practice question
A C program allocates a 64-byte stack buffer for a username but copies user input without checking its length, allowing an attacker to overwrite the saved return address. Which vulnerability is this?
Check answer and explanation
Correct answer: Stack-based buffer overflow
Explanation
Writing more data than a fixed-size stack buffer can hold overwrites adjacent stack memory, including the return address.
Common trap
Writing more data than a fixed-size stack buffer can hold overwrites adjacent stack memory, including the return address.
Source: Original unofficial practice; not an official CompTIA exam item
Checked against the cited text on 2026-11-30.