Blame SOURCES/unzip-6.0-cve-2018-1000035-heap-based-overflow.patch

1ed299
--- a/fileio.c	2014-12-05 05:06:05 -0600
1ed299
+++ b/fileio.c	2017-11-14 01:06:28 -0600
1ed299
@@ -1,5 +1,5 @@
1ed299
 /*
1ed299
-  Copyright (c) 1990-2009 Info-ZIP.  All rights reserved.
1ed299
+  Copyright (c) 1990-2017 Info-ZIP.  All rights reserved.
1ed299
 
1ed299
   See the accompanying file LICENSE, version 2009-Jan-02 or later
1ed299
   (the contents of which are also included in unzip.h) for terms of use.
1ed299
@@ -1582,6 +1582,8 @@
1ed299
     int r = IZ_PW_ENTERED;
1ed299
     char *m;
1ed299
     char *prompt;
1ed299
+    char *ep;
1ed299
+    char *zp;
1ed299
 
1ed299
 #ifndef REENTRANT
1ed299
     /* tell picky compilers to shut up about "unused variable" warnings */
1ed299
@@ -1590,9 +1592,12 @@
1ed299
 
1ed299
     if (*rcnt == 0) {           /* First call for current entry */
1ed299
         *rcnt = 2;
1ed299
-        if ((prompt = (char *)malloc(2*FILNAMSIZ + 15)) != (char *)NULL) {
1ed299
-            sprintf(prompt, LoadFarString(PasswPrompt),
1ed299
-                    FnFilter1(zfn), FnFilter2(efn));
1ed299
+        zp = FnFilter1( zfn);
1ed299
+        ep = FnFilter2( efn);
1ed299
+        prompt = (char *)malloc(        /* Slightly too long (2* "%s"). */
1ed299
+         sizeof( PasswPrompt)+ strlen( zp)+ strlen( ep));
1ed299
+        if (prompt != (char *)NULL) {
1ed299
+            sprintf(prompt, LoadFarString(PasswPrompt), zp, ep);
1ed299
             m = prompt;
1ed299
         } else
1ed299
             m = (char *)LoadFarString(PasswPrompt2);