code.cpp 789 B

1234567891011121314
  1. /* printf is a standard C function that's a great way to easily print
  2. * data to the console using format specifiers. That being said, it's
  3. * common knowledge that you should NEVER give a user the ability to directly
  4. * set the first parameter of a function that can take format specifiers.
  5. * To pass this challenge, you need to find out why users shouldn't be given
  6. * full control of printf. A vulnerable function will take a string you provide
  7. * and pass it to printf along with a value you need to modify.
  8. */
  9. // A format specifier is a character set like %s or %f.
  10. // Look for one that writes to memory.
  11. // int printf ( const char * format, ... );
  12. // dont allow people to write their own format strings with printf - said a wise man
  13. std::string input = "i444 %n";