[ldapvi] Add fix of double free() crash (#949157)

Matej Cepl mcepl at fedoraproject.org
Wed Sep 11 21:26:15 UTC 2013


commit fadad00f6ff555a5c53e4c60a66c66d372b65998
Author: Matěj Cepl <mcepl at redhat.com>
Date:   Wed Sep 11 23:26:04 2013 +0200

    Add fix of double free() crash (#949157)
    
    - Fix old FSF address

 ldapvi-1.7-fix-use-after-free-in-sasl-code.patch |   41 +++
 ldapvi-1.7-incorrect-FSF-address.patch           |  318 ++++++++++++++++++++++
 ldapvi.spec                                      |   15 +-
 3 files changed, 373 insertions(+), 1 deletions(-)
---
diff --git a/ldapvi-1.7-fix-use-after-free-in-sasl-code.patch b/ldapvi-1.7-fix-use-after-free-in-sasl-code.patch
new file mode 100644
index 0000000..456aa75
--- /dev/null
+++ b/ldapvi-1.7-fix-use-after-free-in-sasl-code.patch
@@ -0,0 +1,41 @@
+From 0354081ae7367ed9c85ae450623a308c80d54175 Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
+Date: Fri, 5 Apr 2013 15:32:26 +0200
+Subject: [PATCH] fix use-after-free in sasl code
+
+==20127== Invalid read of size 4
+==20127==    at 0x412AC4: finish_sasl_redirection (sasl.c:67)
+==20127==    by 0x406901: rebind (ldapvi.c:611)
+==20127==    by 0x407843: do_connect (ldapvi.c:732)
+==20127==    by 0x4042F3: main (ldapvi.c:1739)
+==20127==  Address 0x4c6498c is 28 bytes inside a block of size 40 free'd
+==20127==    at 0x4A077E6: free (vg_replace_malloc.c:446)
+==20127==    by 0x4068EE: rebind (ldapvi.c:609)
+==20127==    by 0x407843: do_connect (ldapvi.c:732)
+==20127==    by 0x4042F3: main (ldapvi.c:1739)
+
+Signed-off-by: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
+---
+ ldapvi/ldapvi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ldapvi/ldapvi.c b/ldapvi/ldapvi.c
+index b594327..ebf3c9f 100644
+--- a/ldapvi/ldapvi.c
++++ b/ldapvi/ldapvi.c
+@@ -606,11 +606,11 @@ rebind_sasl(LDAP *ld, bind_options *bind_options, char *dir, int verbose)
+ 		ld, bind_options->user, bind_options->sasl_mech, NULL,
+ 		NULL, sasl_mode, ldapvi_sasl_interact, defaults);
+ 
+-	sasl_defaults_free(defaults);
+ 	if (defaults->fd != -1) {
+ 		finish_sasl_redirection(defaults);
+ 		free(defaults->pathname);
+ 	}
++	sasl_defaults_free(defaults);
+ 
+ 	if (rc != LDAP_SUCCESS) {
+ 		ldap_perror(ld, "ldap_sasl_interactive_bind_s");
+-- 
+1.8.1.4
+
diff --git a/ldapvi-1.7-incorrect-FSF-address.patch b/ldapvi-1.7-incorrect-FSF-address.patch
new file mode 100644
index 0000000..a753485
--- /dev/null
+++ b/ldapvi-1.7-incorrect-FSF-address.patch
@@ -0,0 +1,318 @@
+--- a/COPYING
++++ b/COPYING
+@@ -1,12 +1,12 @@
+-		    GNU GENERAL PUBLIC LICENSE
+-		       Version 2, June 1991
++                    GNU GENERAL PUBLIC LICENSE
++                       Version 2, June 1991
+ 
+- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+  Everyone is permitted to copy and distribute verbatim copies
+  of this license document, but changing it is not allowed.
+ 
+-			    Preamble
++                            Preamble
+ 
+   The licenses for most software are designed to take away your
+ freedom to share and change it.  By contrast, the GNU General Public
+@@ -15,7 +15,7 @@ software--to make sure the software is f
+ General Public License applies to most of the Free Software
+ Foundation's software and to any other program whose authors commit to
+ using it.  (Some other Free Software Foundation software is covered by
+-the GNU Library General Public License instead.)  You can apply it to
++the GNU Lesser General Public License instead.)  You can apply it to
+ your programs, too.
+ 
+   When we speak of free software, we are referring to freedom, not
+@@ -55,8 +55,8 @@ patent must be licensed for everyone's f
+ 
+   The precise terms and conditions for copying, distribution and
+ modification follow.
+-
+-		    GNU GENERAL PUBLIC LICENSE
++
++                    GNU GENERAL PUBLIC LICENSE
+    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+ 
+   0. This License applies to any program or other work which contains
+@@ -110,7 +110,7 @@ above, provided that you also meet all o
+     License.  (Exception: if the Program itself is interactive but
+     does not normally print such an announcement, your work based on
+     the Program is not required to print an announcement.)
+-
++
+ These requirements apply to the modified work as a whole.  If
+ identifiable sections of that work are not derived from the Program,
+ and can be reasonably considered independent and separate works in
+@@ -168,7 +168,7 @@ access to copy from a designated place,
+ access to copy the source code from the same place counts as
+ distribution of the source code, even though third parties are not
+ compelled to copy the source along with the object code.
+-
++
+   4. You may not copy, modify, sublicense, or distribute the Program
+ except as expressly provided under this License.  Any attempt
+ otherwise to copy, modify, sublicense or distribute the Program is
+@@ -225,7 +225,7 @@ impose that choice.
+ 
+ This section is intended to make thoroughly clear what is believed to
+ be a consequence of the rest of this License.
+-
++
+   8. If the distribution and/or use of the Program is restricted in
+ certain countries either by patents or by copyrighted interfaces, the
+ original copyright holder who places the Program under this License
+@@ -255,7 +255,7 @@ make exceptions for this.  Our decision
+ of preserving the free status of all derivatives of our free software and
+ of promoting the sharing and reuse of software generally.
+ 
+-			    NO WARRANTY
++                            NO WARRANTY
+ 
+   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGES.
+ 
+-		     END OF TERMS AND CONDITIONS
+-
+-	    How to Apply These Terms to Your New Programs
++                     END OF TERMS AND CONDITIONS
++
++            How to Apply These Terms to Your New Programs
+ 
+   If you develop a new program, and you want it to be of the greatest
+ possible use to the public, the best way to achieve this is to make it
+@@ -291,7 +291,7 @@ convey the exclusion of warranty; and ea
+ the "copyright" line and a pointer to where the full notice is found.
+ 
+     <one line to give the program's name and a brief idea of what it does.>
+-    Copyright (C) 19yy  <name of author>
++    Copyright (C) <year>  <name of author>
+ 
+     This program is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+@@ -303,17 +303,16 @@ the "copyright" line and a pointer to wh
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+ 
+-    You should have received a copy of the GNU General Public License
+-    along with this program; if not, write to the Free Software
+-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+-
++    You should have received a copy of the GNU General Public License along
++    with this program; if not, write to the Free Software Foundation, Inc.,
++    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ 
+ Also add information on how to contact you by electronic and paper mail.
+ 
+ If the program is interactive, make it output a short notice like this
+ when it starts in an interactive mode:
+ 
+-    Gnomovision version 69, Copyright (C) 19yy name of author
++    Gnomovision version 69, Copyright (C) year name of author
+     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+     This is free software, and you are welcome to redistribute it
+     under certain conditions; type `show c' for details.
+@@ -336,5 +335,5 @@ necessary.  Here is a sample; alter the
+ This General Public License does not permit incorporating your program into
+ proprietary programs.  If your program is a subroutine library, you may
+ consider it more useful to permit linking proprietary applications with the
+-library.  If this is what you want to do, use the GNU Library General
++library.  If this is what you want to do, use the GNU Lesser General
+ Public License instead of this License.
+--- a/arguments.c
++++ b/arguments.c
+@@ -15,11 +15,12 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include <popt.h>
+ #include "common.h"
+-#include "version.h" 
++#include "version.h"
+ 
+ static void parse_configuration(char *, cmdline *, GPtrArray *);
+ 
+@@ -577,7 +578,7 @@ parse_configuration(char *profile_name,
+ 		}
+ 		if (!p)
+ 			break;
+-		if (strcmp(entry_dn(p), profile_name)) 
++		if (strcmp(entry_dn(p), profile_name))
+ 			entry_free(p);
+ 		else if (profile_found)
+ 			duplicate = 1;
+@@ -683,7 +684,7 @@ parse_arguments(int argc, const char **a
+ 		break;
+ 	default:
+ 		abort();
+-	}		
++	}
+ 
+ 	if (result->profileonlyp)
+ 		if (setenv("LDAPNOINIT", "thanks", 1)) syserr();
+--- a/data.c
++++ b/data.c
+@@ -13,7 +13,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include "common.h"
+ 
+--- a/diff.c
++++ b/diff.c
+@@ -13,7 +13,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include "common.h"
+ #include "config.h"
+--- a/error.c
++++ b/error.c
+@@ -12,7 +12,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include <dirent.h>
+ #include <errno.h>
+--- a/ldapvi.c
++++ b/ldapvi.c
+@@ -15,7 +15,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include <curses.h>
+ #include <signal.h>
+--- a/misc.c
++++ b/misc.c
+@@ -13,7 +13,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include <curses.h>
+ #include <term.h>
+--- a/parse.c
++++ b/parse.c
+@@ -13,7 +13,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #define _XOPEN_SOURCE
+ #include <unistd.h>
+--- a/parseldif.c
++++ b/parseldif.c
+@@ -13,7 +13,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #define _XOPEN_SOURCE
+ #include <unistd.h>
+--- a/port.c
++++ b/port.c
+@@ -13,7 +13,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include <dirent.h>
+ #include <errno.h>
+--- a/print.c
++++ b/print.c
+@@ -13,7 +13,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include "common.h"
+ 
+--- a/sasl.c
++++ b/sasl.c
+@@ -14,7 +14,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include <curses.h>
+ #include <signal.h>
+--- a/schema.c
++++ b/schema.c
+@@ -13,7 +13,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include "common.h"
+ 
+--- a/search.c
++++ b/search.c
+@@ -13,7 +13,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include "common.h"
+ 
+--- a/common.h
++++ b/common.h
+@@ -15,7 +15,8 @@
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
+  */
+ #include <dirent.h>
+ #include <errno.h>
diff --git a/ldapvi.spec b/ldapvi.spec
index 8270bcd..3f5e1c0 100644
--- a/ldapvi.spec
+++ b/ldapvi.spec
@@ -1,6 +1,6 @@
 Name:           ldapvi
 Version:        1.7
-Release:        16%{?dist}
+Release:        17%{?dist}
 Summary:        An interactive LDAP client
 
 Group:          Applications/Editors
@@ -13,6 +13,13 @@ Patch1:         %{name}-1.7-getline.patch
 # http://lists.askja.de/pipermail/ldapvi/2011-January/000089.html
 # but never applied
 Patch2:         dont-set-encoding-in-vim-modeline.diff
+# Reported upstream
+# http://lists.askja.de/pipermail/ldapvi/2013-April/000114.html
+Patch3:         ldapvi-1.7-fix-use-after-free-in-sasl-code.patch
+# Reported upstream
+# http://lists.askja.de/pipermail/ldapvi/2013-September/000116.html
+Patch4:         ldapvi-1.7-incorrect-FSF-address.patch
+
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 BuildRequires:  openldap-devel, ncurses-devel, readline-devel, pkgconfig
@@ -33,6 +40,8 @@ it as vipw(1) for LDAP.
 %patch0 -p0 -b .gnumk
 %patch1 -p2 -b .getline
 %patch2 -p2 -b .encoding
+%patch3 -p2 -b .doubleFree
+%patch4 -p1 -b .FSFaddress
 
 %build
 %configure
@@ -59,6 +68,10 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Wed Sep 11 2013 Matěj Cepl <mcepl at redhat.com> - 1.7-17
+- Add fix of double free() crash (#949157)
+- Fix old FSF address
+
 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.7-16
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 


More information about the scm-commits mailing list