From 2dcf00b82f8ee480a1d35b7139dfc9bc9eb095c9 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 2 Dec 2002 21:46:58 +0000 Subject: [PATCH] ldif_fetch_url() would return NULL value or pointless memory if file was empty --- libraries/libldif/fetch.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libraries/libldif/fetch.c b/libraries/libldif/fetch.c index a9b0cafa95..545253e808 100644 --- a/libraries/libldif/fetch.c +++ b/libraries/libldif/fetch.c @@ -87,6 +87,15 @@ ldif_fetch_url( fclose( url ); + if( total == 0 ) { + char *newp = ber_memrealloc( p, 1 ); + if( newp == NULL ) { + ber_memfree( p ); + return -1; + } + p = newp; + } + *valuep = p; *vlenp = total; -- 2.39.5