nerdexam
EC-Council

312-92 · Question #55

312-92 Question #55: Real Exam Question with Answer & Explanation

The correct answer is B. Heap overflow. See the full explanation below for the reasoning.

Question

What would be the result of the following code? #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { char *input=malloc(20); char *output=malloc(20); strcpy(output, "normal output"); strcpy(input, argv[1]); printf("input at %p: %s\n", input, input); printf("output at %p: %s\n", output, output); printf("\n\n%s\n", output); }

Options

  • AStack buffer overflow
  • BHeap overflow
  • CQuery string manipulation
  • DPointer Subterfuge

Community Discussion

No community discussion yet for this question.

Full 312-92 Practice