SOURCES: unzip-CAN-2005-2475.patch (NEW) - fixes CAN-2005-2475

havner havner at pld-linux.org
Thu Nov 24 11:25:08 CET 2005


Author: havner                       Date: Thu Nov 24 10:25:08 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fixes CAN-2005-2475

---- Files affected:
SOURCES:
   unzip-CAN-2005-2475.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/unzip-CAN-2005-2475.patch
diff -u /dev/null SOURCES/unzip-CAN-2005-2475.patch:1.1
--- /dev/null	Thu Nov 24 11:25:08 2005
+++ SOURCES/unzip-CAN-2005-2475.patch	Thu Nov 24 11:25:03 2005
@@ -0,0 +1,50 @@
+--- unzip-5.52.orig/unix/unix.c
++++ unzip-5.52/unix/unix.c
+@@ -1040,9 +1040,7 @@
+         ztimbuf t2;             /* modtime, actime */
+     } zt;
+     ush z_uidgid[2];
+-    int have_uidgid_flg;
+-
+-    fclose(G.outfile);
++    int have_uidgid_flg, outfd;
+ 
+ /*---------------------------------------------------------------------------
+     If symbolic links are supported, allocate storage for a symlink control
+@@ -1080,7 +1078,7 @@
+         strcpy(slnk_entry->fname, G.filename);
+ 
+         /* reopen the "link data" file for reading */
+-        G.outfile = fopen(G.filename, FOPR);
++        G.outfile = freopen(G.filename, FOPR, G.outfile);
+ 
+         if (!G.outfile ||
+             fread(slnk_entry->target, 1, ucsize, G.outfile) != (int)ucsize)
+@@ -1116,11 +1114,12 @@
+ #endif
+ 
+     have_uidgid_flg = get_extattribs(__G__ &(zt.t3), z_uidgid);
++    outfd = fileno(G.outfile);
+ 
+     /* if -X option was specified and we have UID/GID info, restore it */
+     if (have_uidgid_flg) {
+         TTrace((stderr, "close_outfile:  restoring Unix UID/GID info\n"));
+-        if (chown(G.filename, (uid_t)z_uidgid[0], (gid_t)z_uidgid[1]))
++        if (fchown(outfd, (uid_t)z_uidgid[0], (gid_t)z_uidgid[1]))
+         {
+             if (uO.qflag)
+                 Info(slide, 0x201, ((char *)slide,
+@@ -1157,10 +1156,12 @@
+   ---------------------------------------------------------------------------*/
+ 
+ #ifndef NO_CHMOD
+-    if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
++    if (fchmod(outfd, filtattr(__G__ G.pInfo->file_attr)))
+         perror("chmod (file attributes) error");
+ #endif
+ 
++    fclose(G.outfile);
++
+ } /* end function close_outfile() */
+ 
+ #endif /* !MTS */
================================================================



More information about the pld-cvs-commit mailing list