]> git.sur5r.net Git - openldap/commitdiff
ldif_fetch_url() would return NULL value or pointless memory if file was empty
authorHallvard Furuseth <hallvard@openldap.org>
Mon, 2 Dec 2002 21:46:58 +0000 (21:46 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Mon, 2 Dec 2002 21:46:58 +0000 (21:46 +0000)
libraries/libldif/fetch.c

index a9b0cafa9528baf08bcb4eed1dcf1b7e281b32ff..545253e80830ae7da55b881b1117850f847c982b 100644 (file)
@@ -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;