CAS-003 · Question #921
A developer implements the following code snippet: Which of the following vulnerabilities does this code snippet resolve?
The correct answer is B. Buffer overflow. The code snippet (though not displayed) implements input size validation or uses safe memory-handling functions such as bounds checking, limiting input length, or replacing unsafe functions like strcpy() with safer alternatives like strncpy(). Buffer overflow vulnerabilities…
Question
A developer implements the following code snippet:
Which of the following vulnerabilities does this code snippet resolve?
Exhibit
Options
- ASQL injection
- BBuffer overflow
- CMissing session brat
- DInformation leakage
How the community answered
(22 responses)- A14% (3)
- B73% (16)
- C5% (1)
- D9% (2)
Explanation
The code snippet (though not displayed) implements input size validation or uses safe memory-handling functions such as bounds checking, limiting input length, or replacing unsafe functions like strcpy() with safer alternatives like strncpy(). Buffer overflow vulnerabilities occur when more data is written to a fixed-size memory buffer than it can hold, causing data to overflow into adjacent memory regions. Attackers exploit this to overwrite return addresses, inject shellcode, or crash programs. By enforcing input size limits or using bounds-checked functions, the code prevents memory corruption. SQL injection (A) would require parameterized queries; missing session tokens (C) would require session management code; information leakage (D) would require suppressing error messages or data masking.
Topics
Community Discussion
No community discussion yet for this question.
