From: Hallvard Furuseth Date: Wed, 12 Jan 2011 14:41:33 +0000 (+0000) Subject: Catch ber_scanf errors properly X-Git-Tag: MIGRATION_CVS2GIT~211 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=62232822357f8da3dd5f028e66c376108c056a9f;p=openldap Catch ber_scanf errors properly --- diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index f9505df1de..0d508ee7ef 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -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 ); diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index d2f1172ed1..246b4ac6b1 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -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; }