nerdexam
EC-Council

312-92 · Question #25

If a developer wrote the following code, what would the script be vulnerable to? #include <stdio.h> int main(int argc, char **argv) { int number = 5; printf(argv[1]); putchar('\n'); printf("number…

The correct answer is B. Format string attack. See the full explanation below for the reasoning.

Question

If a developer wrote the following code, what would the script be vulnerable to? #include <stdio.h> int main(int argc, char **argv) { int number = 5; printf(argv[1]); putchar('\n'); printf("number (%p) is equal to %d\n", &value, value); }

Options

  • ABuffer overflow
  • BFormat string attack
  • CQuery string manipulation
  • DSQL injection

How the community answered

(55 responses)
  • A
    7% (4)
  • B
    73% (40)
  • C
    4% (2)
  • D
    16% (9)

Community Discussion

No community discussion yet for this question.

Full 312-92 Practice