ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 466 - CAS-004 discussion

Report
Export

A security architect examines a section of code and discovers the following:

Which of the following changes should the security architect require before approving the code for release?

A.
Allow only alphanumeric characters for the username.
Answers
A.
Allow only alphanumeric characters for the username.
B.
Make the password variable longer to support more secure passwords.
Answers
B.
Make the password variable longer to support more secure passwords.
C.
Prevent more than 20 characters from being entered.
Answers
C.
Prevent more than 20 characters from being entered.
D.
Add a password parameter to the checkUserExists function.
Answers
D.
Add a password parameter to the checkUserExists function.
Suggested answer: C

Explanation:

The code snippet presents a buffer size risk where the user input (username) is accepted without limiting the number of characters, potentially leading to buffer overflow vulnerabilities. The best solution is to implement input validation that limits the input to a maximum of 20 characters, matching the buffer size defined in the code. This prevents overflow attacks by ensuring that user input does not exceed the allocated memory space. Other options, like adding more parameters or allowing alphanumeric characters, do not directly address the root cause of buffer overflow vulnerabilities. CASP+ stresses the importance of proper input validation and bounds checking as critical security measures.

CASP+ CAS-004 Exam Objectives: Domain 2.0 -- Enterprise Security Operations (Input Validation and Buffer Overflow Prevention)

CompTIA CASP+ Study Guide: Secure Coding Practices and Input Validation Techniques

asked 02/10/2024
Albert Tedjadiputra
35 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first