]> git.sur5r.net Git - openldap/commitdiff
Output from ldif_fetch_url() is expected to be \0-terminated.
authorHallvard Furuseth <hallvard@openldap.org>
Mon, 2 Dec 2002 22:08:26 +0000 (22:08 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Mon, 2 Dec 2002 22:08:26 +0000 (22:08 +0000)
libraries/libldif/fetch.c

index 545253e80830ae7da55b881b1117850f847c982b..36baf734c2fa3ee9f92219998ba157d896be4c62 100644 (file)
@@ -74,7 +74,7 @@ ldif_fetch_url(
        total = 0;
 
        while( (bytes = fread( buffer, 1, sizeof(buffer), url )) != 0 ) {
-               char *newp = ber_memrealloc( p, total + bytes );
+               char *newp = ber_memrealloc( p, total + bytes + 1 );
                if( newp == NULL ) {
                        ber_memfree( p );
                        fclose( url );
@@ -96,6 +96,7 @@ ldif_fetch_url(
                p = newp;
        }
 
+       p[total] = '\0';
        *valuep = p;
        *vlenp = total;