[Date Prev][Date Next] [Chronological] [Thread] [Top]

Bug in libraries/libldap/cache.c (ITS#1509)



Full_Name: Jeffrey A. Scofield
Version: 2.0.19
OS: Solaris 8 (SunOS 5.8)
URL: 
Submission from: (NULL) (147.145.40.42)


In the function ldap_check_cache() at around line 390 of
libraries/libldap/cache.c the reqber variable is only incompletely
initialized.  The uninitialized parts of the structure can cause problems.
In my tests, for example, it sometimes causes debugging information to be
written out (because the debug flag of the structure happens to be set).

Here are a few lines showing a possible fix for the problem:

        if ( ld->ld_cache == NULL ||
            ( ld->ld_cache->lc_enabled == 0 )) {
                return( -1 );
        }

        memset(&reqber, 0, sizeof reqber); /* ADD THIS LINE */

        reqber.ber_valid = LBER_VALID_BERELEMENT;
        reqber.ber_buf = reqber.ber_ptr = request->ber_buf;
        reqber.ber_end = request->ber_ptr;