Halloween Special 2026! Get Up to 25% OFF Practice Questions! Limited Time - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

GAQM CPEH-001 Exam - Topic 4 Question 114 Discussion

Posted by Ciara on Jul 09, 2025 at 05:00 AM

Buffer X in an Accounting application module for Brownies Inc. can contain 200 characters. The programmer makes an assumption that 200 characters are more than enough. Because there were no proper boundary checks being conducted, Bob decided to insert 400 characters into the 200-character buffer. (Overflows the buffer). Below is the code snippet:

How can you protect/fix the problem of your application as shown above?

Suggested Answer: A, D

Get Premium CPEH-001 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
28 comments · newest first
LA
Lavonne 10 months ago
Option D seems like the best fix to me.
KA
Karol 10 months ago
I totally agree, proper boundary checks are a must!
QU
Queen 11 months ago
Isn't it surprising that they assumed 200 characters would always be enough?
TR
Troy 11 months ago
Wait, how did they not see this coming?
MA
Maile 11 months ago
Buffer overflow is a common issue in programming.
AN
Anabel 11 months ago
I recall that we should definitely have a condition to prevent writing more than 200 characters, so I lean towards option D as the best choice.
MA
Marylyn 12 months ago
I’m a bit confused about the counter starting at 0. Does that mean we should stop at 200 or 199? I need to think this through more.
NA
Narcisa 12 months ago
I think we practiced something similar where we had to stop writing when we reached the buffer limit, so I feel like option D makes sense to me.
NA
Nakisha 12 months ago
I remember we discussed boundary checks in class, but I'm not sure if it's option A or D that correctly addresses the overflow issue.
CO
Corazon 1 year ago
Okay, I think I've got it. The solution is to add a check to ensure that the number of characters being written to the buffer does not exceed the buffer size. Option D looks like the best choice here.
AM
Amie 1 year ago
Ah, I see the problem now. The programmer made the assumption that 200 characters would be enough, but then allowed 400 characters to be written to the buffer. The fix is simple - we just need to add a check to make sure the buffer size is not exceeded.
MI
Mitsue 1 year ago
I'm a bit confused by the code snippet. It's not clear to me exactly where the buffer overflow is happening. I'll need to carefully read through the code and think through the logic to figure out the best way to fix this.
LI
Lili 1 year ago
This looks like a classic buffer overflow issue. I think the key is to properly check the buffer size and not allow more data to be written than the buffer can hold.
GA
Gail 1 year ago
But D doesn't take into account the buffer size, so I still think C is the better choice.
EN
Enola 1 year ago
I'm not sure, I think D could also be a valid solution.
BE
Bette 1 year ago
I agree with Gail, C seems like the best option.
RO
Rochell 1 year ago
Hmm, let's see... I'd say option D is the way to go. Checking the buffer size and stopping the write when it's full is the safest approach. Can't have Bob's shenanigans messing up the app, now can we?
TH
Thurman 1 year ago
Option D is the clear winner here. Limiting the write to the buffer size is the best way to prevent this kind of buffer overflow problem. Nice try, Bob, but we can't let you break the system like that!
RA
Rasheeda 1 year ago
↳ replying to Thurman
I agree, option D is the best choice to prevent buffer overflow.
GA
Gail 1 year ago
I think the correct answer is C.
LO
Louis 1 year ago
Haha, good one Bob! Trying to overflow the buffer. But seriously, option D is the way to go. Gotta keep that buffer in check, you know?
JE
Jeff 1 year ago
↳ replying to Louis
User 3: User 3: Buffer overflow can cause serious issues. Option D is the best choice.
BO
Bobbye 1 year ago
↳ replying to Louis
User 2: User 2: Yeah, that's a classic mistake. Option D is definitely the fix.
MA
Martina 1 year ago
↳ replying to Louis
User 1: Haha, Bob, you really tried to overflow the buffer?
ET
Ettie 1 year ago
Definitely go with option D. Adding a separate statement to check if the buffer has reached its capacity is the most straightforward way to fix this issue.
KE
Kerry 1 year ago
↳ replying to Ettie
Absolutely, option D is the way to go to protect the application from buffer overflow.
HO
Horace 1 year ago
↳ replying to Ettie
Yes, adding a separate statement to check the buffer capacity is crucial in avoiding such issues.
ON
Ona 1 year ago
↳ replying to Ettie
I agree, option D is the best solution to prevent buffer overflow.
0/2000 characters

Save Cancel