View | Details | Raw Unified | Return to bug 42865
Collapse All | Expand All

(-)magick/utility.c.orig (+30 lines)
Lines 3258-3264 Link Here
3258
%      name is returned in this array.
3258
%      name is returned in this array.
3259
%
3259
%
3260
*/
3260
*/
3261
3262
/* Attention: this creates an additional 
3263
 * intermediate directory for security reasons,
3264
 * but unfortunately it is never deleted.
3265
 */
3266
static void TemporaryFilenameHelper(char *);
3261
MagickExport void TemporaryFilename(char *path)
3267
MagickExport void TemporaryFilename(char *path)
3268
{
3269
    static char *mSafeTmpdir = NULL;
3270
    char *name;
3271
3272
    path[0] = '\0';
3273
    if (mSafeTmpdir == NULL) {
3274
        do {
3275
            TemporaryFilenameHelper(path);
3276
            if (mkdir(path, S_IRWXU) == 0) {
3277
                mSafeTmpdir = strdup(path);
3278
                break;
3279
            }
3280
        } while (errno == EEXIST);
3281
    }
3282
    if (mSafeTmpdir == NULL)
3283
        return;
3284
    if ((name = tempnam(mSafeTmpdir, (char *)NULL)) == NULL)
3285
        return;
3286
    (void)strncpy(path, name, MaxTextExtent-1);
3287
    free(name);
3288
    return;
3289
}
3290
3291
static void TemporaryFilenameHelper(char *path)
3262
{
3292
{
3263
#define RandomKeyExtent  6
3293
#define RandomKeyExtent  6
3264
3294

Return to bug 42865