Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

As shown, care should be taken that the arguments passed to a format string function match up with the supplied format string.

Another common mistake is to use more format specifiers than supplied arguments. This results in undefined behavior, which could end up pulling extra values off the stack and unintentionally exposing data.

Code Block
bgColor#ffcccc

char const *error_msg = "Error occurred";
/* ... */
printf("Error (%s): %s", error_msg);

Risk Assessment

Incorrectly using a variadic function can result in abnormal program termination or unintended information disclosure.

...