07_fix-formatstring.patch 694 B

123456789101112131415161718192021
  1. Description: Prevent arbitrary long file names
  2. Author: George Danchev <danchev@spnet.net>
  3. Last-Update: 2009-10-25
  4. Index: scrot-0.8/src/options.c
  5. ===================================================================
  6. --- scrot-0.8.orig/src/options.c
  7. +++ scrot-0.8/src/options.c
  8. @@ -124,6 +124,12 @@ scrot_parse_option_array(int argc, char
  9. if (!opt.output_file)
  10. {
  11. opt.output_file = argv[optind++];
  12. +
  13. + if ( strlen(opt.output_file) > 256 ) {
  14. + printf("output filename too long.\n");
  15. + exit(EXIT_FAILURE);
  16. + }
  17. +
  18. if (opt.thumb)
  19. opt.thumb_file = name_thumbnail(opt.output_file);
  20. }