Commit 21796e67 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Don't assume offsetof(foo,firstelement) is zero

parent 1989cf6f
...@@ -986,7 +986,7 @@ static int parsePreRead ( ...@@ -986,7 +986,7 @@ static int parsePreRead (
} }
siz = sizeof( AttributeName ); siz = sizeof( AttributeName );
off = 0; off = offsetof( AttributeName, an_name );
if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) { if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) {
rs->sr_text = "preread control: decoding error"; rs->sr_text = "preread control: decoding error";
return LDAP_PROTOCOL_ERROR; return LDAP_PROTOCOL_ERROR;
...@@ -1035,7 +1035,7 @@ static int parsePostRead ( ...@@ -1035,7 +1035,7 @@ static int parsePostRead (
} }
siz = sizeof( AttributeName ); siz = sizeof( AttributeName );
off = 0; off = offsetof( AttributeName, an_name );
if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) { if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) {
rs->sr_text = "postread control: decoding error"; rs->sr_text = "postread control: decoding error";
return LDAP_PROTOCOL_ERROR; return LDAP_PROTOCOL_ERROR;
......
...@@ -159,7 +159,7 @@ do_search( ...@@ -159,7 +159,7 @@ do_search(
/* attributes */ /* attributes */
siz = sizeof(AttributeName); siz = sizeof(AttributeName);
off = 0; off = offsetof(AttributeName,an_name);
if ( ber_scanf( op->o_ber, "{M}}", &op->ors_attrs, &siz, off ) == LBER_ERROR ) { 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" ); send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding attrs error" );
rs->sr_err = SLAPD_DISCONNECT; rs->sr_err = SLAPD_DISCONNECT;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment