From: Hallvard Furuseth Date: Mon, 2 Dec 2002 21:46:58 +0000 (+0000) Subject: ldif_fetch_url() would return NULL value or pointless memory if file was empty X-Git-Tag: NO_SLAP_OP_BLOCKS~741 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2dcf00b82f8ee480a1d35b7139dfc9bc9eb095c9;p=openldap ldif_fetch_url() would return NULL value or pointless memory if file was empty --- 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;