rpms/openldap/devel openldap-2.4.18-ldif-buf-overflow.patch, 1.1, 1.2 openldap.spec, 1.150, 1.151

Jan Zeleny jzeleny at fedoraproject.org
Thu Sep 24 13:23:53 UTC 2009


Author: jzeleny

Update of /cvs/extras/rpms/openldap/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv5855

Modified Files:
	openldap-2.4.18-ldif-buf-overflow.patch openldap.spec 
Log Message:
Cleanup of previous patch

openldap-2.4.18-ldif-buf-overflow.patch:
 ldif.c |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

Index: openldap-2.4.18-ldif-buf-overflow.patch
===================================================================
RCS file: /cvs/extras/rpms/openldap/devel/openldap-2.4.18-ldif-buf-overflow.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- openldap-2.4.18-ldif-buf-overflow.patch	24 Sep 2009 11:30:24 -0000	1.1
+++ openldap-2.4.18-ldif-buf-overflow.patch	24 Sep 2009 13:23:53 -0000	1.2
@@ -1,26 +1,54 @@
 --- openldap-2.4.18/servers/slapd/back-ldif/ldif.c.orig	2009-09-24 09:46:01.000000000 +0200
-+++ openldap-2.4.18/servers/slapd/back-ldif/ldif.c	2009-09-24 12:41:09.000000000 +0200
-@@ -593,9 +593,12 @@ typedef struct bvlist {
++++ openldap-2.4.18/servers/slapd/back-ldif/ldif.c	2009-09-24 13:40:07.000000000 +0200
+@@ -593,9 +593,7 @@ typedef struct bvlist {
  	char *trunc;	/* filename was truncated here */
  	int  inum;		/* num from "attr={num}" in filename, or INT_MIN */
  	char savech;	/* original char at *trunc */
 -	char fname;		/* variable length array BVL_NAME(bvl) = &fname */
 -#	define BVL_NAME(bvl) ((char *) (bvl) + offsetof(bvlist, fname))
 -#	define BVL_SIZE(namelen) (sizeof(bvlist) + (namelen))
-+	char *fname;		/* variable length array BVL_NAME(bvl) = &fname */
-+	//char fname;		/* variable length array BVL_NAME(bvl) = &fname */
-+#	define BVL_NAME(bvl) ((bvl)->fname)
-+#	define BVL_SIZE(namelen) (sizeof(bvlist))
-+//#	define BVL_NAME(bvl) ((char *) (bvl) + offsetof(bvlist, fname))
-+//#	define BVL_SIZE(namelen) (sizeof(bvlist) + (namelen))
++	char *fname;		/* variable length array */
  } bvlist;
  
  static int
-@@ -710,6 +713,7 @@ ldif_readdir(
+@@ -709,17 +707,18 @@ ldif_readdir(
+ 			if ( *fname_maxlenp < fname_len )
  				*fname_maxlenp = fname_len;
  
- 			bvl = SLAP_MALLOC( BVL_SIZE( fname_len ) );
+-			bvl = SLAP_MALLOC( BVL_SIZE( fname_len ) );
++			bvl = SLAP_MALLOC( sizeof( bvlist ) );
 +			bvl->fname = SLAP_MALLOC( fname_len+1 );
  			if ( bvl == NULL ) {
  				rc = LDAP_OTHER;
  				save_errno = errno;
+ 				break;
+ 			}
+-			strcpy( BVL_NAME( bvl ), dir->d_name );
++			strcpy( bvl->fname, dir->d_name );
+ 
+ 			/* Make it sortable by ("attr=val" or <preceding {num}, num>) */
+-			trunc = BVL_NAME( bvl ) + fname_len - STRLENOF( LDIF );
+-			if ( (idxp = strchr( BVL_NAME( bvl ) + 2, IX_FSL )) != NULL &&
++			trunc = bvl->fname + fname_len - STRLENOF( LDIF );
++			if ( (idxp = strchr( bvl->fname + 2, IX_FSL )) != NULL &&
+ 				 (endp = strchr( ++idxp, IX_FSR )) != NULL && endp > idxp &&
+ 				 (eq_unsafe || idxp[-2] == '=' || endp + 1 == trunc) )
+ 			{
+@@ -737,7 +736,7 @@ ldif_readdir(
+ 			*trunc = '\0';
+ 
+ 			for ( prev = listp; (ptr = *prev) != NULL; prev = &ptr->next ) {
+-				int cmp = strcmp( BVL_NAME( bvl ), BVL_NAME( ptr ));
++				int cmp = strcmp( bvl->fname, ptr->fname );
+ 				if ( cmp < 0 || (cmp == 0 && bvl->inum < ptr->inum) )
+ 					break;
+ 			}
+@@ -826,7 +825,7 @@ ldif_search_entry(
+ 
+ 				if ( rc == LDAP_SUCCESS ) {
+ 					*ptr->trunc = ptr->savech;
+-					FILL_PATH( &fpath, dir_end, BVL_NAME( ptr ));
++					FILL_PATH( &fpath, dir_end, ptr->fname );
+ 
+ 					rc = ldif_read_entry( op, fpath.bv_val, &dn, &ndn,
+ 						&e, text );


Index: openldap.spec
===================================================================
RCS file: /cvs/extras/rpms/openldap/devel/openldap.spec,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -p -r1.150 -r1.151
--- openldap.spec	24 Sep 2009 11:30:24 -0000	1.150
+++ openldap.spec	24 Sep 2009 13:23:53 -0000	1.151
@@ -11,7 +11,7 @@
 Summary: LDAP support libraries
 Name: openldap
 Version: %{version}
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: OpenLDAP
 Group: System Environment/Daemons
 Source0: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version}.tgz
@@ -639,6 +639,9 @@ fi
 %attr(0644,root,root)      %{evolution_connector_libdir}/*.a
 
 %changelog
+* Thu Sep 24 2009 Jan Zeleny <jzeleny at redhat.com> 2.4.18-3
+- cleanup of previous patch fixing buffer overflow
+
 * Tue Sep 22 2009 Jan Zeleny <jzeleny at redhat.com> 2.4.18-2
 - changed configuration approach. Instead od slapd.conf slapd
   is using slapd.d directory now




More information about the fedora-extras-commits mailing list