linville pushed to unzoo (f20). "Actually add patches for above changes..."

notifications at fedoraproject.org notifications at fedoraproject.org
Mon Mar 30 22:27:34 UTC 2015


>From f43e80940f37c2dcf379454453fe3482cfb22fde Mon Sep 17 00:00:00 2001
From: "John W. Linville" <linville at tuxdriver.com>
Date: Mon, 30 Mar 2015 15:04:45 -0400
Subject: Actually add patches for above changes...


diff --git a/unzoo-convert-strcpy_strcat-to-strncpy_strncat.patch b/unzoo-convert-strcpy_strcat-to-strncpy_strncat.patch
new file mode 100644
index 0000000..a352f21
--- /dev/null
+++ b/unzoo-convert-strcpy_strcat-to-strncpy_strncat.patch
@@ -0,0 +1,95 @@
+diff -up unzoo-4.4/unzoo.c.orig unzoo-4.4/unzoo.c
+--- unzoo-4.4/unzoo.c.orig	2015-03-30 13:54:26.830442154 -0400
++++ unzoo-4.4/unzoo.c	2015-03-30 13:54:29.636472741 -0400
+@@ -247,6 +247,7 @@
+ *H
+ */
+ #include        <stdio.h>
++#include        <string.h>
+ 
+ 
+ /****************************************************************************
+@@ -508,16 +509,16 @@ FILE *          WritBinr;
+ **  want to use the universal conversion function 'ConvName'.
+ */
+ #ifdef  SYS_IS_UNIX
+-#define CONV_NAME(naml,namu)    strcpy( (naml), (namu) )
++#define CONV_NAME(naml,namu)    strncpy( (naml), (namu), sizeof((naml)) - 1 )
+ #endif
+ #ifdef  SYS_IS_DOS_DJGPP
+ #define CONV_NAME(naml,namu)    ConvName( (naml), (namu), 8L, 3L, '_' )
+ #endif
+ #ifdef  SYS_IS_OS2_EMX
+-#define CONV_NAME(naml,namu)    strcpy( (naml), (namu) )
++#define CONV_NAME(naml,namu)    stnrcpy( (naml), (namu), sizeof((naml)) - 1 )
+ #endif
+ #ifdef  SYS_IS_TOS_GCC
+-#define CONV_NAME(naml,namu)    strcpy( (naml), (namu) )
++#define CONV_NAME(naml,namu)    stnrcpy( (naml), (namu), sizeof((naml)) - 1 )
+ #endif
+ #ifdef  SYS_IS_VMS
+ #define CONV_NAME(naml,namu)    ConvName( (naml), (namu), 39L, 39L, '_' )
+@@ -1224,9 +1225,9 @@ int             MakeDirs ( pre, patu )
+         *d = '\0';  *n = '\0';
+         CONV_DIRE( dirl, diru );
+         CONV_NAME( naml, namu );
+-        strcpy( patl, pre  );
+-        strcat( patl, dirl );
+-        strcat( patl, naml );
++        strncpy( patl, pre,  sizeof(patl) - 1 );
++        strncat( patl, dirl, sizeof(patl) - 1 );
++        strncat( patl, naml, sizeof(patl) - 1 );
+         /*N 1993/11/03 martin what should I do with the return code?       */
+         /*N 1993/11/03 martin it could be 0 if the directory exists!       */
+         MAKE_DIRE( patl );
+@@ -1583,14 +1584,15 @@ int             EntrReadArch ()
+         CONV_NAME( Entry.naml, (Entry.lnamu ? Entry.namu : Entry.nams) );
+     }
+     else {
+-        strcpy( Entry.dirl, Entry.diru );
+-        strcpy( Entry.naml, (Entry.lnamu ? Entry.namu : Entry.nams) );
++        strncpy( Entry.dirl, Entry.diru, sizeof(Entry.dirl) - 1 );
++        strncpy( Entry.naml, (Entry.lnamu ? Entry.namu : Entry.nams),
++	         sizeof(Entry.naml) - 1 );
+     }
+-    strcpy( Entry.patl, Entry.dirl );
+-    strcat( Entry.patl, Entry.naml );
++    strncpy( Entry.patl, Entry.dirl, sizeof(Entry.patl) - 1 );
++    strncat( Entry.patl, Entry.naml, sizeof(Entry.patl) - 1 );
+ 
+     /* create the name with the version appended                           */
+-    strcpy( Entry.patv, Entry.patl );
++    strncpy( Entry.patv, Entry.patl, sizeof(Entry.patv) - 1 );
+     p = Entry.patv;  while ( *p != '\0' )  p++;
+     *p++ = ';';
+     for ( l = 10000; 0 < l; l /= 10 )
+@@ -2349,7 +2351,8 @@ int             ListArch ( ver, arc, fil
+     unsigned long       i;              /* loop variable                   */
+ 
+     /* try to open the archive under various names                         */
+-    strcpy(arczoo,arc);  strcat(arczoo,".zoo");
++    strncpy(arczoo,arc,sizeof(arczoo)-1);
++    strncat(arczoo,".zoo",sizeof(arczoo)-1);
+     if ( OpenReadArch(arc) ) {
+         if ( ! DescReadArch() ) {
+             ClosReadArch();
+@@ -2504,7 +2507,8 @@ int             ExtrArch ( bim, out, ovr
+     unsigned long       i;              /* loop variable                   */
+ 
+     /* try to open the archive under various names                         */
+-    strcpy(arczoo,arc);  strcat(arczoo,".zoo");
++    strncpy(arczoo,arc,sizeof(arczoo)-1);
++    strncat(arczoo,".zoo",sizeof(arczoo)-1);
+     if ( OpenReadArch(arc) ) {
+         if ( ! DescReadArch() ) {
+             ClosReadArch();
+@@ -2577,7 +2581,8 @@ int             ExtrArch ( bim, out, ovr
+         }
+ 
+         /* check that such a file does not already exist                   */
+-        strcpy( patl, pre );  strcat( patl, Entry.patl );
++        strncpy( patl, pre, sizeof(patl) - 1 );
++        strncat( patl, Entry.patl, sizeof(patl) - 1 );
+         if ( out == 2 && ovr == 0 && OpenReadFile(patl,0L) ) {
+             ClosReadFile();
+             do {
diff --git a/unzoo-directory-points-backward.patch b/unzoo-directory-points-backward.patch
new file mode 100644
index 0000000..51917d9
--- /dev/null
+++ b/unzoo-directory-points-backward.patch
@@ -0,0 +1,29 @@
+diff -up unzoo-4.4/unzoo.c.revdir unzoo-4.4/unzoo.c
+--- unzoo-4.4/unzoo.c.revdir	2015-03-30 14:14:24.056860147 -0400
++++ unzoo-4.4/unzoo.c	2015-03-30 14:22:42.632963876 -0400
+@@ -2398,9 +2398,11 @@ int             ListArch ( ver, arc, fil
+     /* loop over the members of the archive                                */
+     Entry.posnxt = Descript.posent;
+     while ( 1 ) {
++	unsigned long oldpos = Entry.posnxt;
+ 
+         /* read the directory entry for the next member                    */
+-        if ( ! GotoReadArch( Entry.posnxt ) || ! EntrReadArch() ) {
++        if ( ! GotoReadArch( Entry.posnxt ) || ! EntrReadArch() ||
++             Entry.posnxt <= oldpos ) {
+             printf("unzoo: found bad directory entry in archive '%s'\n",arc);
+             return 0;
+         }
+@@ -2553,9 +2555,11 @@ int             ExtrArch ( bim, out, ovr
+     /* loop over the members of the archive                                */
+     Entry.posnxt = Descript.posent;
+     while ( 1 ) {
++	unsigned long oldpos = Entry.posnxt;
+ 
+         /* read the directory entry for the next member                    */
+-        if ( ! GotoReadArch( Entry.posnxt ) || ! EntrReadArch() ) {
++        if ( ! GotoReadArch( Entry.posnxt ) || ! EntrReadArch() ||
++             Entry.posnxt <= oldpos ) {
+             printf("unzoo: found bad directory entry in archive '%s'\n",arc);
+             return 0;
+         }
diff --git a/unzoo-warning-fixes.patch b/unzoo-warning-fixes.patch
new file mode 100644
index 0000000..6d552de
--- /dev/null
+++ b/unzoo-warning-fixes.patch
@@ -0,0 +1,37 @@
+diff -up unzoo-4.4/unzoo.c.warnings unzoo-4.4/unzoo.c
+--- unzoo-4.4/unzoo.c.warnings	2015-03-30 14:30:36.169829567 -0400
++++ unzoo-4.4/unzoo.c	2015-03-30 14:38:42.082812600 -0400
+@@ -247,8 +247,13 @@
+ *H
+ */
+ #include        <stdio.h>
++#include        <stdlib.h>
+ #include        <string.h>
+ 
++#include        <sys/stat.h>
++#include        <sys/types.h>
++#include        <utime.h>
++
+ 
+ /****************************************************************************
+ **
+@@ -617,8 +622,8 @@ char            Cmd [256];
+ **  members with the correct time as stored in the archive.
+ */
+ #ifdef  SYS_IS_UNIX
+-unsigned int   Secs [2];
+-#define SETF_TIME(patl,secs)    (Secs[0]=Secs[1]=(secs),!utime((patl),Secs))
++struct  utimbuf Secs;
++#define SETF_TIME(patl,secs)    (Secs.actime=Secs.modtime=(secs),!utime((patl),&Secs))
+ #endif
+ #ifdef  SYS_IS_DOS_DJGPP
+ unsigned long   Secs [2];
+@@ -1465,7 +1470,7 @@ struct {
+ int             DescReadArch ()
+ {
+     /* read the text at the beginning                                      */
+-    BlckReadArch(Descript.text,20L);  Descript.text[20] = '\0';
++    BlckReadArch(Descript.text,19L);  Descript.text[19] = '\0';
+ 
+     /* try to read the magic words                                         */
+     if ( (Descript.magic = WordReadArch()) != (unsigned long)0xfdc4a7dcL )
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/unzoo.git/commit/?h=f20&id=f43e80940f37c2dcf379454453fe3482cfb22fde


More information about the scm-commits mailing list