nerdexam
EC-Council

EC0-350 · Question #126

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…

The correct answer is A. Because the counter starts with 0, we would stop when the counter is less than 200 D. Add a separate statement to signify that if we have written 200 characters to the buffer, the stack. See the full explanation below for the reasoning.

Question

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?

Options

  • ABecause the counter starts with 0, we would stop when the counter is less than 200
  • BBecause the counter starts with 0, we would stop when the counter is more than 200
  • CAdd a separate statement to signify that if we have written less than 200 characters to the buffer,
  • DAdd a separate statement to signify that if we have written 200 characters to the buffer, the stack

How the community answered

(32 responses)
  • A
    78% (25)
  • B
    16% (5)
  • C
    6% (2)

Community Discussion

No community discussion yet for this question.

Full EC0-350 Practice