From 3121074ad72bf6a4ef2a29c9440a4e740e2e1947 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 2 Dec 2002 22:08:26 +0000 Subject: [PATCH] Output from ldif_fetch_url() is expected to be \0-terminated. --- libraries/libldif/fetch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.39.5