libtiff/libtiff-3.8.2-tiffsplit_overflow.patch

23 lines
611 B
Diff

--- tiff-3.8.2/tools/tiffsplit.c 2005-12-07 10:48:33.000000000 +0100
+++ /tmp/tiffsplit.c 2006-06-07 16:33:25.000000000 +0200
@@ -60,14 +60,16 @@
fprintf(stderr, "usage: tiffsplit input.tif [prefix]\n");
return (-3);
}
- if (argc > 2)
- strcpy(fname, argv[2]);
+ if (argc > 2) {
+ strncpy(fname, argv[2], 1024);
+ fname[1024] = '\0';
+ }
in = TIFFOpen(argv[1], "r");
if (in != NULL) {
do {
char path[1024+1];
newfilename();
- strcpy(path, fname);
+ strncpy(path, fname, 1020);
strcat(path, ".tif");
out = TIFFOpen(path, TIFFIsBigEndian(in)?"wb":"wl");
if (out == NULL)