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

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