Sign compare checking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm going through the list of sign-compare errors from gcc, and putting
in the appropriate casts (uint -> int normally).

I found in filter.c:

        /* openldap does not return LBER_END_OF_SEQORSET -
           so check for len == -1 - openldap ber_next_element will not
set
           len if it has reached the end, and -1 is not a valid value
           for a real len */
        if ( (tag != LBER_END_OF_SEQORSET) && (len != -1) && (*fstr !=
NULL) ) {
                LDAPDebug( LDAP_DEBUG_ANY, "   error parsing filter list
\n", 0, 0, 0 );
                slapi_ch_free((void**)fstr );
        }


However, len is a ber_len_t, which is a typedef uint. It's actually
impossible for this value to hold a -1.

So either, this is a bug in the way openldap uses the ber_len_t type, we
have a mistake in our logic, or something else hokey is going on. 

I would like to update this to:

if ( (tag != LBER_END_OF_SEQORSET) && (len == 0) && (*fstr != NULL) )

Or even:

if ( (tag != LBER_END_OF_SEQORSET) && (*fstr != NULL) )

What do you think of this assessment given the ber_len_t type? 

-- 
Sincerely,

William Brown
Software Engineer
Red Hat, Brisbane

Attachment: signature.asc
Description: This is a digitally signed message part

--
389-devel mailing list
389-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://lists.fedoraproject.org/admin/lists/389-devel@xxxxxxxxxxxxxxxxxxxxxxx

[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux