[Date Prev][Date Next] [Chronological] [Thread] [Top]

Bug in ldapadd/ldapmodify reading url from ldif file (ITS#601)



URL files in an ldif file are not being read properly on non Unix systems.

The binary option needs to be set.  In addition, the code clobbers
the address of the buffer just realloc'd with the address of the
original buffer, which may cause memory corruption.

-Steve Sonntag
-Alan Clark

See below:

===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldif/fetch.c,v
retrieving revision 1.8
diff -w -u -r1.8 fetch.c
--- fetch.c     2000/05/13 00:38:40     1.8
+++ fetch.c     2000/06/20 17:10:51
@@ -59,7 +59,7 @@
                p = ber_strdup( p );
                ldap_pvt_hex_unescape( p );

-               url = fopen( p, "r" );
+               url = fopen( p, "rb" );

        } else {
                return -1;
@@ -79,7 +79,7 @@
                        fclose( url );
                        return -1;
                }
-               newp = p;
+               p = newp;
                SAFEMEMCPY( &p[total], buffer, bytes );
                total += bytes;
        }