Skip to contentSkip to conversation

unzip: fixes strange output

PATCH In review Edwin Plauchu 2 participants 3 messages Aug 30, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unzip: fixes strange output

From: Edwin Plauchu <[email protected]>

This fixes commit 763a3d424bccf559a8d6add3dc1f2746c82f2933

Output was strange when using unzip to extract zip file. This patch fixed so.

[YOCTO #9551]

---
 .../unzip/unzip/fix-security-format.patch          | 198 ++++++++-------------
 1 file changed, 78 insertions(+), 120 deletions(-)
meta/recipes-extended/unzip/unzip/fix-security-format.patch +78 -120
index c82f502..8e9b06c 100644
@@ -9,131 +9,89 @@ Upstream-Status: Pending
 
 Signed-off-by: Edwin Plauchu <[email protected]>
 
-diff --git a/unzpriv.h b/unzpriv.h
-index c8d3eab..85e693a 100644
---- a/unzpriv.h
-+++ b/unzpriv.h
-@@ -1006,7 +1006,7 @@
- #    define LoadFarStringSmall(x)   Qstrfix(x)
- #    define LoadFarStringSmall2(x)  Qstrfix(x)
- #  else
--#    define LoadFarString(x)        (char *)(x)
-+#    define LoadFarString(x)        "%s",(char *)(x)
- #    define LoadFarStringSmall(x)   (char *)(x)
- #    define LoadFarStringSmall2(x)  (char *)(x)
- #  endif
-diff --git a/fileio.c b/fileio.c
-index 36bfea3..ca779c2 100644
---- a/fileio.c
-+++ b/fileio.c
-@@ -588,8 +588,8 @@ unsigned readbuf(__G__ buf, size)   /* return number of bytes read into buf */
-             else if (G.incnt < 0) {
-                 /* another hack, but no real harm copying same thing twice */
-                 (*G.message)((zvoid *)&G,
--                  (uch *)LoadFarString(ReadError),  /* CANNOT use slide */
--                  (ulg)strlen(LoadFarString(ReadError)), 0x401);
-+                  (uch *)(char*)(ReadError),  /* CANNOT use slide */
-+                  (ulg)strlen((char*)(ReadError)), 0x401);
-                 return 0;  /* discarding some data; better than lock-up */
-             }
-             /* buffer ALWAYS starts on a block boundary:  */
-@@ -631,8 +631,8 @@ int readbyte(__G)   /* refill inbuf and return a byte if available, else EOF */
-         } else if (G.incnt < 0) {  /* "fail" (abort, retry, ...) returns this */
-             /* another hack, but no real harm copying same thing twice */
-             (*G.message)((zvoid *)&G,
--              (uch *)LoadFarString(ReadError),
--              (ulg)strlen(LoadFarString(ReadError)), 0x401);
-+              (uch *)(char*)(ReadError),
-+              (ulg)strlen((char*)(ReadError)), 0x401);
-             echon();
- #ifdef WINDLL
-             longjmp(dll_error_return, 1);
-@@ -1356,7 +1356,7 @@ int UZ_EXP UzpMessagePrnt(pG, buf, size, flag)
-                 ++((Uz_Globs *)pG)->lines;
-                 if (((Uz_Globs *)pG)->lines >= ((Uz_Globs *)pG)->height)
-                     (*((Uz_Globs *)pG)->mpause)((zvoid *)pG,
--                      LoadFarString(MorePrompt), 1);
-+                      (char*)(MorePrompt), 1);
-             }
- #endif /* MORE */
-             if (MSG_STDERR(flag) && ((Uz_Globs *)pG)->UzO.tflag &&
-@@ -1416,7 +1416,7 @@ int UZ_EXP UzpMessagePrnt(pG, buf, size, flag)
-                     ((Uz_Globs *)pG)->sol = TRUE;
-                     q = p + 1;
-                     (*((Uz_Globs *)pG)->mpause)((zvoid *)pG,
--                      LoadFarString(MorePrompt), 1);
-+                      (char*)(MorePrompt), 1);
+diff --git a/extract.c b/extract.c
+index 7cd9123..25c5a62 100644
+--- a/extract.c
++++ b/extract.c
+@@ -475,7 +475,7 @@ int extract_or_test_files(__G)    /* return PK-type error code */
+                     Info(slide, 0x401, ((char *)slide,
+                       LoadFarString(CentSigMsg), j + blknum*DIR_BLKSIZ + 1));
+                     Info(slide, 0x401, ((char *)slide,
+-                      LoadFarString(ReportMsg)));
++                      "%s",LoadFarString(ReportMsg)));
+                     error_in_archive = PK_BADERR;
                  }
+                 reached_end = TRUE;     /* ...so no more left to do */
+@@ -754,8 +754,8 @@ int extract_or_test_files(__G)    /* return PK-type error code */
+
+ #ifndef SFX
+     if (no_endsig_found) {                      /* just to make sure */
+-        Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
+-        Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg)));
++        Info(slide, 0x401, ((char *)slide, "%s", LoadFarString(EndSigMsg)));
++        Info(slide, 0x401, ((char *)slide, "%s", LoadFarString(ReportMsg)));
+         if (!error_in_archive)       /* don't overwrite stronger error */
+             error_in_archive = PK_WARN;
+     }
+diff --git a/list.c b/list.c
+index 15e0011..0b484f6 100644
+--- a/list.c
++++ b/list.c
+@@ -181,7 +181,7 @@ int list_files(__G)    /* return PK-type error code */
+                 Info(slide, 0x401,
+                      ((char *)slide, LoadFarString(CentSigMsg), j));
+                 Info(slide, 0x401,
+-                     ((char *)slide, LoadFarString(ReportMsg)));
++                     ((char *)slide, "%s", LoadFarString(ReportMsg)));
+                 return PK_BADERR;   /* sig not found */
              }
-             INCSTR(p);
-@@ -2176,7 +2176,7 @@ int do_string(__G__ length, option)   /* return PK-type error code */
-                     (*G.message)((zvoid *)&G, slide, (ulg)(q-slide), 0);
-                     q = slide;
-                     if (pause && G.extract_flag) /* don't pause for list/test */
--                        (*G.mpause)((zvoid *)&G, LoadFarString(QuitPrompt), 0);
-+                        (*G.mpause)((zvoid *)&G, (char*)(QuitPrompt), 0);
-                 }
+         }
+@@ -507,7 +507,7 @@ int list_files(__G)    /* return PK-type error code */
+             && (!G.ecrec.is_zip64_archive)
+             && (memcmp(G.sig, end_central_sig, 4) != 0)
+            ) {          /* just to make sure again */
+-            Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
++            Info(slide, 0x401, ((char *)slide, "%s", LoadFarString(EndSigMsg)));
+             error_in_archive = PK_WARN;   /* didn't find sig */
+         }
+
+@@ -591,7 +591,7 @@ int get_time_stamp(__G__ last_modtime, nmember)  /* return PK-type error code */
+                 Info(slide, 0x401,
+                      ((char *)slide, LoadFarString(CentSigMsg), j));
+                 Info(slide, 0x401,
+-                     ((char *)slide, LoadFarString(ReportMsg)));
++                     ((char *)slide, "%s", LoadFarString(ReportMsg)));
+                 return PK_BADERR;   /* sig not found */
              }
-             (*G.message)((zvoid *)&G, slide, (ulg)(q-slide), 0);
-diff --git a/unzip.c b/unzip.c
-index 2d94a38..ca135af 100644
---- a/unzip.c
-+++ b/unzip.c
-@@ -1079,7 +1079,7 @@ int unzip(__G__ argc, argv)
- #ifndef _WIN32_WCE /* Win CE does not support environment variables */
-         if ((error = envargs(&argc, &argv, LoadFarStringSmall(EnvZipInfo),
-                              LoadFarStringSmall2(EnvZipInfo2))) != PK_OK)
--            perror(LoadFarString(NoMemEnvArguments));
-+            perror((char*)(NoMemEnvArguments));
- #endif
-     } else
- #endif /* !NO_ZIPINFO */
-@@ -1088,7 +1088,7 @@ int unzip(__G__ argc, argv)
- #ifndef _WIN32_WCE /* Win CE does not support environment variables */
-         if ((error = envargs(&argc, &argv, LoadFarStringSmall(EnvUnZip),
-                              LoadFarStringSmall2(EnvUnZip2))) != PK_OK)
--            perror(LoadFarString(NoMemEnvArguments));
-+            perror((char*)(NoMemEnvArguments));
- #endif
-     }
+         }
+@@ -674,7 +674,7 @@ int get_time_stamp(__G__ last_modtime, nmember)  /* return PK-type error code */
+   ---------------------------------------------------------------------------*/
  
+     if (memcmp(G.sig, end_central_sig, 4)) {    /* just to make sure again */
+-        Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
++        Info(slide, 0x401, ((char *)slide, "%s", LoadFarString(EndSigMsg)));
+         error_in_archive = PK_WARN;
+     }
+     if (*nmember == 0L && error_in_archive <= PK_WARN)
 diff --git a/zipinfo.c b/zipinfo.c
-index 0ac75b3..8a0887c 100644
+index 0ac75b3..1e7fa82 100644
 --- a/zipinfo.c
 +++ b/zipinfo.c
-@@ -1640,14 +1640,14 @@ static int zi_long(__G__ pEndprev, error_in_archive)
+@@ -833,7 +833,7 @@ int zipinfo(__G)   /* return PK-type error code */
+                 Info(slide, 0x401,
+                      ((char *)slide, LoadFarString(CentSigMsg), j));
+                 Info(slide, 0x401,
+-                     ((char *)slide, LoadFarString(ReportMsg)));
++                     ((char *)slide, "%s", LoadFarString(ReportMsg)));
+                 error_in_archive = PK_BADERR;   /* sig not found */
+                 break;
+             }
+@@ -1022,7 +1022,7 @@ int zipinfo(__G)   /* return PK-type error code */
+             && (!G.ecrec.is_zip64_archive)
+             && (memcmp(G.sig, end_central_sig, 4) != 0)
+            ) {          /* just to make sure again */
+-            Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
++            Info(slide, 0x401, ((char *)slide, "%s", LoadFarString(EndSigMsg)));
+             error_in_archive = PK_WARN;   /* didn't find sig */
+         }
  
-                         *types = '\0';
-                         if (*ef_ptr & 1) {
--                            strcpy(types, LoadFarString(UTmodification));
-+                            strcpy(types, (char*)(UTmodification));
-                             ++num;
-                         }
-                         if (*ef_ptr & 2) {
-                             len = strlen(types);
-                             if (num)
-                                 types[len++] = '/';
--                            strcpy(types+len, LoadFarString(UTaccess));
-+                            strcpy(types+len, (char*)(UTaccess));
-                             ++num;
-                             if (*pEndprev > 0L)
-                                 *pEndprev += 4L;
-@@ -1656,7 +1656,7 @@ static int zi_long(__G__ pEndprev, error_in_archive)
-                             len = strlen(types);
-                             if (num)
-                                 types[len++] = '/';
--                            strcpy(types+len, LoadFarString(UTcreation));
-+                            strcpy(types+len, (char *)(UTcreation));
-                             ++num;
-                             if (*pEndprev > 0L)
-                                 *pEndprev += 4L;
-@@ -2331,7 +2331,7 @@ static char *zi_time(__G__ datetimez, modtimez, d_t_str)
-             /* time conversion error in verbose listing format,
-              * return string with '?' instead of data
-              */
--            return (strcpy(d_t_str, LoadFarString(lngYMDHMSTimeError)));
-+            return (strcpy(d_t_str, (char*)(lngYMDHMSTimeError)));
-     } else
-         t = (struct tm *)NULL;
-     if (t != (struct tm *)NULL) {
-
Signature · 1 line
2.9.3
#1 lore raw
Quoted 5 lines · Edwin Plauchu

From: Edwin Plauchu <[email protected]>

This fixes commit 763a3d424bccf559a8d6add3dc1f2746c82f2933

Quoted 8 lines

Output was strange when using unzip to extract zip file. This patch fixed so.

[YOCTO #9551]

---
 .../unzip/unzip/fix-security-format.patch          | 198

++++++++-------------

Review

Quoted 3 lines
 1 file changed, 78 insertions(+), 120 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-extended/unzip/unzip/fix-security-format.patch

Quoted 7 lines

index c82f502..8e9b06c 100644

meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -0
@@ -9,131 +9,89 @@ Upstream-Status: Pending
 
 Signed-off-by: Edwin Plauchu <[email protected]>
 

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 21

Quoted 10 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -10
-diff --git a/unzpriv.h b/unzpriv.h
-index c8d3eab..85e693a 100644
---- a/unzpriv.h
-+++ b/unzpriv.h
-@@ -1006,7 +1006,7 @@
- #    define LoadFarStringSmall(x)   Qstrfix(x)
- #    define LoadFarStringSmall2(x)  Qstrfix(x)
- #  else
--#    define LoadFarString(x)        (char *)(x)
-+#    define LoadFarString(x)        "%s",(char *)(x)

LoadFarString is used a _lot_ in various different ways, usually as argument to another macro or function. This sort of macro change seems potentially very dangerous in C, have you checked this is ok in every case?.

I gave an example from extract.c in the bug report:

    Info(slide, 0x201, ((char *)slide,
        LoadFarString(SymLnkWarnInvalid), FnFilter1(linkfname)))

may end up calling sprintf like this:

sprintf ((char *)slide,
LoadFarString(SymLnkWarnInvalid), FnFilter1(linkfname))

That still seems unlikely to work with the proposed LoadFarString change.

another example below.

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 8 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -8
- #    define LoadFarStringSmall(x)   (char *)(x)
- #    define LoadFarStringSmall2(x)  (char *)(x)
- #  endif
-diff --git a/fileio.c b/fileio.c
-index 36bfea3..ca779c2 100644
---- a/fileio.c
-+++ b/fileio.c
-@@ -588,8 +588,8 @@ unsigned readbuf(__G__ buf, size)   /* return number

of bytes read into buf */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 31

Quoted 2 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -2
-             else if (G.incnt < 0) {
-                 /* another hack, but no real harm copying same thing

twice */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 33

Quoted 2 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -2
-                 (*G.message)((zvoid *)&G,
--                  (uch *)LoadFarString(ReadError),  /* CANNOT use slide

*/

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 4 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -4
--                  (ulg)strlen(LoadFarString(ReadError)), 0x401);
-+                  (uch *)(char*)(ReadError),  /* CANNOT use slide */
-+                  (ulg)strlen((char*)(ReadError)), 0x401);
-                 return 0;  /* discarding some data; better than lock-up

*/

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 3 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -3
-             }
-             /* buffer ALWAYS starts on a block boundary:  */
-@@ -631,8 +631,8 @@ int readbyte(__G)   /* refill inbuf and return a

byte if available, else EOF */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 41

Quoted 1 line
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -1
-         } else if (G.incnt < 0) {  /* "fail" (abort, retry, ...)

returns this */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 42

Quoted 1 line
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -1
-             /* another hack, but no real harm copying same thing twice

*/

Quoted 18 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -18
-             (*G.message)((zvoid *)&G,
--              (uch *)LoadFarString(ReadError),
--              (ulg)strlen(LoadFarString(ReadError)), 0x401);
-+              (uch *)(char*)(ReadError),
-+              (ulg)strlen((char*)(ReadError)), 0x401);
-             echon();
- #ifdef WINDLL
-             longjmp(dll_error_return, 1);
-@@ -1356,7 +1356,7 @@ int UZ_EXP UzpMessagePrnt(pG, buf, size, flag)
-                 ++((Uz_Globs *)pG)->lines;
-                 if (((Uz_Globs *)pG)->lines >= ((Uz_Globs *)pG)->height)
-                     (*((Uz_Globs *)pG)->mpause)((zvoid *)pG,
--                      LoadFarString(MorePrompt), 1);
-+                      (char*)(MorePrompt), 1);
-             }
- #endif /* MORE */
-             if (MSG_STDERR(flag) && ((Uz_Globs *)pG)->UzO.tflag &&
-@@ -1416,7 +1416,7 @@ int UZ_EXP UzpMessagePrnt(pG, buf, size, flag)

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 10 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +5 -5
-                     ((Uz_Globs *)pG)->sol = TRUE;
-                     q = p + 1;
-                     (*((Uz_Globs *)pG)->mpause)((zvoid *)pG,
--                      LoadFarString(MorePrompt), 1);
-+                      (char*)(MorePrompt), 1);
+diff --git a/extract.c b/extract.c
+index 7cd9123..25c5a62 100644
+--- a/extract.c
++++ b/extract.c
+@@ -475,7 +475,7 @@ int extract_or_test_files(__G)    /* return PK-type

error code */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 18

Quoted 2 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +2 -0
+                     Info(slide, 0x401, ((char *)slide,
+                       LoadFarString(CentSigMsg), j + blknum*DIR_BLKSIZ

+ 1));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 21

Quoted 3 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +3 -0
+                     Info(slide, 0x401, ((char *)slide,
+-                      LoadFarString(ReportMsg)));
++                      "%s",LoadFarString(ReportMsg)));

AFAICS this may end up as:
sprintf ((char *)slide, "%s", LoadFarString(ReportMsg))
which with the new macro definition would mean:

    sprintf ((char *)slide, "%s", "%s", (char *)(ReportMsg))

This also seems unlikely to do what was meant.

Jussi

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 4 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +3 -0
+                     error_in_archive = PK_BADERR;
                  }
+                 reached_end = TRUE;     /* ...so no more left to do */
+@@ -754,8 +754,8 @@ int extract_or_test_files(__G)    /* return PK-type

error code */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 6 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +6 -0
+
+ #ifndef SFX
+     if (no_endsig_found) {                      /* just to make sure */
+-        Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
+-        Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg)));
++        Info(slide, 0x401, ((char *)slide, "%s",

LoadFarString(EndSigMsg)));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 32

Quoted 1 line
meta/recipes-extended/unzip/unzip/fix-security-format.patch +1 -0
++        Info(slide, 0x401, ((char *)slide, "%s",

LoadFarString(ReportMsg)));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 33

Quoted 1 line
meta/recipes-extended/unzip/unzip/fix-security-format.patch +1 -0
+         if (!error_in_archive)       /* don't overwrite stronger error

*/

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 7 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +7 -0
+             error_in_archive = PK_WARN;
+     }
+diff --git a/list.c b/list.c
+index 15e0011..0b484f6 100644
+--- a/list.c
++++ b/list.c
+@@ -181,7 +181,7 @@ int list_files(__G)    /* return PK-type error code

*/

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 9 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +6 -2
+                 Info(slide, 0x401,
+                      ((char *)slide, LoadFarString(CentSigMsg), j));
+                 Info(slide, 0x401,
+-                     ((char *)slide, LoadFarString(ReportMsg)));
++                     ((char *)slide, "%s", LoadFarString(ReportMsg)));
+                 return PK_BADERR;   /* sig not found */
              }
-             INCSTR(p);
-@@ -2176,7 +2176,7 @@ int do_string(__G__ length, option)   /* return

PK-type error code */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 3 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -3
-                     (*G.message)((zvoid *)&G, slide, (ulg)(q-slide), 0);
-                     q = slide;
-                     if (pause && G.extract_flag) /* don't pause for

list/test */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 73

Quoted 1 line
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -1
--                        (*G.mpause)((zvoid *)&G,

LoadFarString(QuitPrompt), 0);

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 74

Quoted 1 line
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -1
-+                        (*G.mpause)((zvoid *)&G, (char*)(QuitPrompt),

0);

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 3 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +2 -1
-                 }
+         }
+@@ -507,7 +507,7 @@ int list_files(__G)    /* return PK-type error code

*/

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 4 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +4 -0
+             && (!G.ecrec.is_zip64_archive)
+             && (memcmp(G.sig, end_central_sig, 4) != 0)
+            ) {          /* just to make sure again */
+-            Info(slide, 0x401, ((char *)slide,

LoadFarString(EndSigMsg)));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 54

Quoted 1 line
meta/recipes-extended/unzip/unzip/fix-security-format.patch +1 -0
++            Info(slide, 0x401, ((char *)slide, "%s",

LoadFarString(EndSigMsg)));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 4 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +4 -0
+             error_in_archive = PK_WARN;   /* didn't find sig */
+         }
+
+@@ -591,7 +591,7 @@ int get_time_stamp(__G__ last_modtime, nmember)  /*

return PK-type error code */

Quoted 5 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +5 -0
+                 Info(slide, 0x401,
+                      ((char *)slide, LoadFarString(CentSigMsg), j));
+                 Info(slide, 0x401,
+-                     ((char *)slide, LoadFarString(ReportMsg)));
++                     ((char *)slide, "%s", LoadFarString(ReportMsg)));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 10 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +1 -8
+                 return PK_BADERR;   /* sig not found */
              }
-             (*G.message)((zvoid *)&G, slide, (ulg)(q-slide), 0);
-diff --git a/unzip.c b/unzip.c
-index 2d94a38..ca135af 100644
---- a/unzip.c
-+++ b/unzip.c
-@@ -1079,7 +1079,7 @@ int unzip(__G__ argc, argv)
- #ifndef _WIN32_WCE /* Win CE does not support environment variables */
-         if ((error = envargs(&argc, &argv,

LoadFarStringSmall(EnvZipInfo),

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 85

Quoted 1 line
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -1
-                              LoadFarStringSmall2(EnvZipInfo2))) !=

PK_OK)

Quoted 5 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -5
--            perror(LoadFarString(NoMemEnvArguments));
-+            perror((char*)(NoMemEnvArguments));
- #endif
-     } else
- #endif /* !NO_ZIPINFO */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 10 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +2 -8
-@@ -1088,7 +1088,7 @@ int unzip(__G__ argc, argv)
- #ifndef _WIN32_WCE /* Win CE does not support environment variables */
-         if ((error = envargs(&argc, &argv, LoadFarStringSmall(EnvUnZip),
-                              LoadFarStringSmall2(EnvUnZip2))) != PK_OK)
--            perror(LoadFarString(NoMemEnvArguments));
-+            perror((char*)(NoMemEnvArguments));
- #endif
-     }
+         }
+@@ -674,7 +674,7 @@ int get_time_stamp(__G__ last_modtime, nmember)  /*

return PK-type error code */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 68

Quoted 1 line
meta/recipes-extended/unzip/unzip/fix-security-format.patch +1 -0
+

---------------------------------------------------------------------------*/

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 69

Quoted 2 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +1 -0
+     if (memcmp(G.sig, end_central_sig, 4)) {    /* just to make sure

again */

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 71

Quoted 2 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +2 -0
+-        Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
++        Info(slide, 0x401, ((char *)slide, "%s",

LoadFarString(EndSigMsg)));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 9 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +4 -2
+         error_in_archive = PK_WARN;
+     }
+     if (*nmember == 0L && error_in_archive <= PK_WARN)
 diff --git a/zipinfo.c b/zipinfo.c
-index 0ac75b3..8a0887c 100644
+index 0ac75b3..1e7fa82 100644
 --- a/zipinfo.c
 +++ b/zipinfo.c
-@@ -1640,14 +1640,14 @@ static int zi_long(__G__ pEndprev,

error_in_archive)

Quoted 4 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +4 -0
+@@ -833,7 +833,7 @@ int zipinfo(__G)   /* return PK-type error code */
+                 Info(slide, 0x401,
+                      ((char *)slide, LoadFarString(CentSigMsg), j));
+                 Info(slide, 0x401,

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 10 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +10 -0
+-                     ((char *)slide, LoadFarString(ReportMsg)));
++                     ((char *)slide, "%s", LoadFarString(ReportMsg)));
+                 error_in_archive = PK_BADERR;   /* sig not found */
+                 break;
+             }
+@@ -1022,7 +1022,7 @@ int zipinfo(__G)   /* return PK-type error code */
+             && (!G.ecrec.is_zip64_archive)
+             && (memcmp(G.sig, end_central_sig, 4) != 0)
+            ) {          /* just to make sure again */
+-            Info(slide, 0x401, ((char *)slide,

LoadFarString(EndSigMsg)));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 93

Quoted 1 line
meta/recipes-extended/unzip/unzip/fix-security-format.patch +1 -0
++            Info(slide, 0x401, ((char *)slide, "%s",

LoadFarString(EndSigMsg)));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 6 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +2 -3
+             error_in_archive = PK_WARN;   /* didn't find sig */
+         }
 
-                         *types = '\0';
-                         if (*ef_ptr & 1) {
--                            strcpy(types,

LoadFarString(UTmodification));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 13 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -13
-+                            strcpy(types, (char*)(UTmodification));
-                             ++num;
-                         }
-                         if (*ef_ptr & 2) {
-                             len = strlen(types);
-                             if (num)
-                                 types[len++] = '/';
--                            strcpy(types+len, LoadFarString(UTaccess));
-+                            strcpy(types+len, (char*)(UTaccess));
-                             ++num;
-                             if (*pEndprev > 0L)
-                                 *pEndprev += 4L;
-@@ -1656,7 +1656,7 @@ static int zi_long(__G__ pEndprev,

error_in_archive)

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 4 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -4
-                             len = strlen(types);
-                             if (num)
-                                 types[len++] = '/';
--                            strcpy(types+len,

LoadFarString(UTcreation));

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending

Quoted 5 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -5
-+                            strcpy(types+len, (char *)(UTcreation));
-                             ++num;
-                             if (*pEndprev > 0L)
-                                 *pEndprev += 4L;
-@@ -2331,7 +2331,7 @@ static char *zi_time(__G__ datetimez, modtimez,

d_t_str)

Quoted 17 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -10
-             /* time conversion error in verbose listing format,
-              * return string with '?' instead of data
-              */
--            return (strcpy(d_t_str, LoadFarString(lngYMDHMSTimeError)));
-+            return (strcpy(d_t_str, (char*)(lngYMDHMSTimeError)));
-     } else
-         t = (struct tm *)NULL;
-     if (t != (struct tm *)NULL) {
-
--

2.9.3

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 27 lines · Jussi Kukkonen
Quoted 5 lines · Edwin Plauchu

From: Edwin Plauchu <[email protected]>

This fixes commit 763a3d424bccf559a8d6add3dc1f2746c82f2933

Quoted 8 lines

Output was strange when using unzip to extract zip file. This patch fixed so.

[YOCTO #9551]

---
 .../unzip/unzip/fix-security-format.patch          | 198

++++++++-------------

Review

Quoted 3 lines
 1 file changed, 78 insertions(+), 120 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-extended/unzip/unzip/fix-security-format.patch

Quoted 7 lines

index c82f502..8e9b06c 100644

meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -0
@@ -9,131 +9,89 @@ Upstream-Status: Pending
 
 Signed-off-by: Edwin Plauchu <[email protected]>
 
Quoted 15 lines

meta/recipes-extended/unzip/unzip/fix-security-format.patch Upstream-Status: Pending · line 21

Quoted 10 lines
meta/recipes-extended/unzip/unzip/fix-security-format.patch +0 -10
-diff --git a/unzpriv.h b/unzpriv.h
-index c8d3eab..85e693a 100644
---- a/unzpriv.h
-+++ b/unzpriv.h
-@@ -1006,7 +1006,7 @@
- #    define LoadFarStringSmall(x)   Qstrfix(x)
- #    define LoadFarStringSmall2(x)  Qstrfix(x)
- #  else
--#    define LoadFarString(x)        (char *)(x)
-+#    define LoadFarString(x)        "%s",(char *)(x)

LoadFarString is used a _lot_ in various different ways, usually as argument to another macro or function. This sort of macro change seems potentially very dangerous in C, have you checked this is ok in every case?.

Edwin just pointed out to me that the patch actually removes this macro change, and he's correct. My patch-of-patch reading failure.

So I'm fine with this patch, sorry for noise.
Jussi