]> git.sur5r.net Git - openldap/commitdiff
Don't assume offsetof(foo,firstelement) is zero
authorKurt Zeilenga <kurt@openldap.org>
Wed, 19 Nov 2003 18:04:49 +0000 (18:04 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 19 Nov 2003 18:04:49 +0000 (18:04 +0000)
servers/slapd/controls.c
servers/slapd/search.c

index 8c445855bc0c8501efcd9a1e38f219c628b9509e..16a9e3fcdce63f07ef6a5b5df0fe5149c40d26ab 100644 (file)
@@ -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;
index 2fdd461653bda58d3212c87bfc48deb1d3b3c5a8..0b898a78bb77ed790a82f50a44b60a722c20879c 100644 (file)
@@ -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;