]> git.pld-linux.org Git - packages/ImageMagick.git/blame - ImageMagick-tmp_fix.patch
- security fix
[packages/ImageMagick.git] / ImageMagick-tmp_fix.patch
CommitLineData
51f4b2c8 1--- ImageMagick-5.5.5/magick/utility.c.orig Thu Feb 27 21:10:51 2003
2+++ ImageMagick-5.5.5/magick/utility.c Tue Jul 1 20:09:46 2003
3@@ -2644,7 +2644,7 @@
4 % name is returned in this array.
5 %
6 */
7-MagickExport void TemporaryFilename(char *path)
8+static void TemporaryFilenameHelper(char *path)
9 {
10 #define RandomKeyExtent 6
11
12@@ -2706,6 +2706,39 @@
13 (void) strncat(path,".tmp",MaxTextExtent-strlen(path)-1);
14 } while (IsAccessible(path));
15 }
16+
17+ MagickExport void TemporaryFilename(char *path)
18+ {
19+ static char
20+ *mSafeTmpdir = NULL;
21+
22+ char
23+ *name;
24+
25+ if (!mSafeTmpdir)
26+ {
27+ do
28+ {
29+ TemporaryFilenameHelper(path);
30+ if (mkdir(path, S_IRWXU) == 0)
31+ {
32+ mSafeTmpdir = strdup(path);
33+ break;
34+ }
35+ } while (errno == EEXIST);
36+ }
37+
38+ /* FIXME: Need to address VMS and older MacOS */
39+ name = tempnam(mSafeTmpdir, (char *) NULL);
40+ if (!name || !mSafeTmpdir)
41+ {
42+ path[0] = '\0';
43+ return;
44+ }
45+ (void) strncpy(path,name,MaxTextExtent-1);
46+ free(name);
47+ }
48+
49 \f
50 /*
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This page took 0.039348 seconds and 4 git commands to generate.