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

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