nerdexam
EC-Council

312-92 · Question #55

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")

Sign in or unlock 312-92 to reveal the answer and full explanation for question #55. The question stem and answer options stay visible for context.

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

Unlock 312-92 to see the answer

You've previewed enough free 312-92 questions. Unlock 312-92 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 312-92 Practice