summaryrefslogtreecommitdiff
path: root/source/l/libtiff/tiff-3.8.2.tiffsplit.commandline.overflow.diff
blob: feb693fabf980db2ee3abceadbf52ccf580e195d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- ./tools/tiffsplit.c.orig	2005-12-07 03:48:33.000000000 -0600
+++ ./tools/tiffsplit.c	2006-08-17 22:03:36.000000000 -0500
@@ -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)