GPEN · Question #35
Which of the following programming languages are NOT vulnerable to buffer overflow attacks? Each correct answer represents a complete solution. Choose two.
The correct answer is A. Perl C. Java. Java and Perl use managed runtime environments with automatic memory and bounds management, inherently preventing buffer overflows, while C and C++ expose raw memory access with no automatic bounds checking.
Question
Which of the following programming languages are NOT vulnerable to buffer overflow attacks? Each correct answer represents a complete solution. Choose two.
Options
- APerl
- BC++
- CJava
- DC
How the community answered
(30 responses)- A80% (24)
- B13% (4)
- D7% (2)
Why each option
Java and Perl use managed runtime environments with automatic memory and bounds management, inherently preventing buffer overflows, while C and C++ expose raw memory access with no automatic bounds checking.
Perl uses an interpreted, managed runtime that automatically handles memory allocation and enforces array bounds, eliminating the direct pointer manipulation that causes buffer overflow vulnerabilities.
C++ supports raw pointer manipulation and manual memory allocation without automatic bounds checking, leaving it fully susceptible to buffer overflow vulnerabilities.
Java executes on the JVM, which enforces strict array bounds checking at runtime and prohibits direct pointer arithmetic, making classic stack and heap buffer overflow attacks impossible in pure Java code.
C relies entirely on manual memory management with pointer arithmetic and no built-in array bounds enforcement, making it historically the most vulnerable language to buffer overflow exploits.
Concept tested: Buffer overflow vulnerability by programming language
Source: https://owasp.org/www-community/vulnerabilities/Buffer_Overflow
Topics
Community Discussion
No community discussion yet for this question.