]> granicus.if.org Git - php/commitdiff
Added missing success check around chmod() for windows during temp file creation
authorIlia Alshanetsky <iliaa@php.net>
Tue, 11 Jan 2011 12:57:19 +0000 (12:57 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 11 Jan 2011 12:57:19 +0000 (12:57 +0000)
main/php_open_temporary_file.c

index 91662a05ade0c3803ab9a3b77116367c5877513f..00a0f3f446a8c199ca8fa7c8d815e1fd64f71569 100644 (file)
@@ -149,7 +149,11 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char **
        if (GetTempFileName(new_state.cwd, pfx, 0, opened_path)) {
                /* Some versions of windows set the temp file to be read-only,
                 * which means that opening it will fail... */
-               VCWD_CHMOD(opened_path, 0600);
+               if (VCWD_CHMOD(opened_path, 0600)) {
+                       efree(opened_path);
+                       free(new_state.cwd);
+                       return -1;
+               }
                fd = VCWD_OPEN_MODE(opened_path, open_flags, 0600);
        }