diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index 8c445855bc..16a9e3fcdc 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -986,7 +986,7 @@ static int parsePreRead ( } siz = sizeof( AttributeName ); - off = 0; + off = offsetof( AttributeName, an_name ); if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) { rs->sr_text = "preread control: decoding error"; return LDAP_PROTOCOL_ERROR; @@ -1035,7 +1035,7 @@ static int parsePostRead ( } siz = sizeof( AttributeName ); - off = 0; + off = offsetof( AttributeName, an_name ); if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) { rs->sr_text = "postread control: decoding error"; return LDAP_PROTOCOL_ERROR; diff --git a/servers/slapd/search.c b/servers/slapd/search.c index 2fdd461653..0b898a78bb 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -159,7 +159,7 @@ do_search( /* attributes */ siz = sizeof(AttributeName); - off = 0; + off = offsetof(AttributeName,an_name); if ( ber_scanf( op->o_ber, "{M}}", &op->ors_attrs, &siz, off ) == LBER_ERROR ) { send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding attrs error" ); rs->sr_err = SLAPD_DISCONNECT;