unzip/unzip-CVE-2005-2475.patch

37 lines
1.1 KiB
Diff

--- unix/unix.c
+++ unix/unix.c
@@ -1042,6 +1042,16 @@
ush z_uidgid[2];
int have_uidgid_flg;
+/*---------------------------------------------------------------------------
+ Change the file permissions from default ones to those stored in the
+ zipfile. This has to done *before* closing the file.
+ ---------------------------------------------------------------------------*/
+
+#ifndef NO_CHMOD
+ if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
+ perror("chmod (file attributes) error");
+#endif
+
fclose(G.outfile);
/*---------------------------------------------------------------------------
@@ -1151,16 +1161,6 @@
#endif /* ?AOS_VS */
}
-/*---------------------------------------------------------------------------
- Change the file permissions from default ones to those stored in the
- zipfile.
- ---------------------------------------------------------------------------*/
-
-#ifndef NO_CHMOD
- if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
- perror("chmod (file attributes) error");
-#endif
-
} /* end function close_outfile() */
#endif /* !MTS */