From: Hallvard Furuseth Date: Mon, 2 Dec 2002 22:08:26 +0000 (+0000) Subject: Output from ldif_fetch_url() is expected to be \0-terminated. X-Git-Tag: NO_SLAP_OP_BLOCKS~740 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3121074ad72bf6a4ef2a29c9440a4e740e2e1947;p=openldap Output from ldif_fetch_url() is expected to be \0-terminated. --- diff --git a/libraries/libldif/fetch.c b/libraries/libldif/fetch.c index 545253e808..36baf734c2 100644 --- a/libraries/libldif/fetch.c +++ b/libraries/libldif/fetch.c @@ -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;