]> eyrie.org Git - kerberos/krb5-strength.git/commitdiff
Close file descriptor and memory leak in CrackLib
authorRuss Allbery <eagle@eyrie.org>
Fri, 13 Dec 2013 21:53:27 +0000 (13:53 -0800)
committerRuss Allbery <eagle@eyrie.org>
Fri, 13 Dec 2013 21:53:27 +0000 (13:53 -0800)
Close a file descriptor and memory leak in the included version of
CrackLib.  This problem was already fixed in CrackLib 2.9.0.

NEWS
cracklib/HISTORY
cracklib/packlib.c

diff --git a/NEWS b/NEWS
index 73e34af6ad1cc671557656b3d1fe33ff33a728c4..d8bdeb64b063f05dc71c2aaf7e1af7f5e7711c0a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,9 @@ krb5-strength 2.2 (unreleased)
     also supports running in filter mode to produce a new wordlist instead
     of a CDB file (-o).
 
+    Close a file descriptor and memory leak in the included version of
+    CrackLib.  This problem was already fixed in CrackLib 2.9.0.
+
 krb5-strength 2.1 (2013-10-10)
 
     Fix the package build when CDB support is disabled or TinyCDB was not
index 35c72ae30fc52c66220a252cb36415c812917403..80c2196ae76b8e9ec630563a1e32c75772f9856c 100644 (file)
@@ -20,6 +20,7 @@ following modifications have been made:
  * Remove last block optimization in GetPW and start fresh each time.
  * Close the dictionary after each password lookup.
  * Set hidden visibility on all CrackLib symbols.
+ * Close the wfp file handle on PWClose if it's open.
 
 Below is the original changelog for CrackLib:
 
index c7f97991608b1e745bddedd6088b5e8990c40321..74e75fd3f0a944780062e7ba57351c076349a587 100644 (file)
@@ -24,6 +24,8 @@
  * 2013-09-24  Russ Allbery <eagle@eyrie.org>
  *   - Add a missing ANSI C prototype.
  *   - Remove last block optimization in GetPW and start fresh each time.
+ * 2013-12-13  Russ Allbery <eagle@eyrie.org>
+ *   - Close the wfp file handle on PWClose if it's open.
  */
 
 #include <stdio.h>
@@ -97,6 +99,10 @@ PWOpen(const char *prefix, const char *mode)
            pdesc.header.pih_magic = 0;
            fclose(ifp);
            fclose(dfp);
+           if (wfp != NULL)
+           {
+               fclose(wfp);
+           }
            return ((PWDICT *) 0);
        }
 
@@ -107,6 +113,10 @@ PWOpen(const char *prefix, const char *mode)
            pdesc.header.pih_magic = 0;
            fclose(ifp);
            fclose(dfp);
+           if (wfp != NULL)
+           {
+               fclose(wfp);
+           }
            return ((PWDICT *) 0);
        }
 
@@ -117,6 +127,10 @@ PWOpen(const char *prefix, const char *mode)
            pdesc.header.pih_magic = 0;
            fclose(ifp);
            fclose(dfp);
+           if (wfp != NULL)
+           {
+               fclose(wfp);
+           }
            return ((PWDICT *) 0);
        }
 
@@ -177,6 +191,10 @@ PWClose(PWDICT *pwp)
 
     fclose(pwp->ifp);
     fclose(pwp->dfp);
+    if (pwp->wfp != NULL)
+    {
+       fclose(pwp->wfp);
+    }
 
     pwp->header.pih_magic = 0;