void-packages/srcpkgs/scrot/patches/07_fix-formatstring.patch

21 lines
659 B
Diff

Description: Prevent arbitrary long file names
Author: George Danchev <danchev@spnet.net>
Last-Update: 2009-10-25
Index: src/options.c
===================================================================
--- src/options.c
+++ src/options.c
@@ -124,6 +124,12 @@ scrot_parse_option_array(int argc, char
if (!opt.output_file)
{
opt.output_file = argv[optind++];
+
+ if ( strlen(opt.output_file) > 256 ) {
+ printf("output filename too long.\n");
+ exit(EXIT_FAILURE);
+ }
+
if (opt.thumb)
opt.thumb_file = name_thumbnail(opt.output_file);
}