From 62232822357f8da3dd5f028e66c376108c056a9f Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Wed, 12 Jan 2011 14:41:33 +0000 Subject: [PATCH] Catch ber_scanf errors properly --- servers/slapd/connection.c | 4 ++-- servers/slapd/filter.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) 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; } -- 2.39.5