]> git.sur5r.net Git - openldap/commitdiff
Catch ber_scanf errors properly
authorHallvard Furuseth <hallvard@openldap.org>
Wed, 12 Jan 2011 14:41:33 +0000 (14:41 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Wed, 12 Jan 2011 14:41:33 +0000 (14:41 +0000)
servers/slapd/connection.c
servers/slapd/filter.c

index f9505df1deae6e9a0c2fe34c43de1c449309acb1..0d508ee7ef6eca1f66a66a5ad5c598025ff70d53 100644 (file)
@@ -1526,8 +1526,8 @@ connection_input( Connection *conn , conn_readinfo *cri )
 #ifdef LDAP_CONNECTIONLESS
        if( conn->c_is_udp ) {
                if( tag == LBER_OCTETSTRING ) {
-                       ber_get_stringa( ber, &cdn );
-                       tag = ber_peek_tag(ber, &len);
+                       if ( (tag = ber_get_stringa( ber, &cdn )) != LBER_ERROR )
+                               tag = ber_peek_tag( ber, &len );
                }
                if( tag != LDAP_REQ_ABANDON && tag != LDAP_REQ_SEARCH ) {
                        Debug( LDAP_DEBUG_ANY, "invalid req for UDP 0x%lx\n", tag, 0, 0 );
index d2f1172ed1ea1848be239c3d4e5c4337604bb342..246b4ac6b13c0cd856f6d097bf281f6c0a064f3a 100644 (file)
@@ -402,8 +402,7 @@ get_ssa(
        {
                unsigned usage;
 
-               rc = ber_scanf( ber, "m", &value );
-               if ( rc == LBER_ERROR ) {
+               if ( ber_scanf( ber, "m", &value ) == LBER_ERROR ) {
                        rc = SLAPD_DISCONNECT;
                        goto return_error;
                }