From: Hallvard Furuseth Date: Fri, 24 Oct 2008 17:52:05 +0000 (+0000) Subject: ITS#5770: Fix unaligned BerElements: Use BerElementBuffer, not char[size]. X-Git-Tag: ACLCHECK_0~1194 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dffe8d37faea1509f86df2aac0e97b175f4c487c;p=openldap ITS#5770: Fix unaligned BerElements: Use BerElementBuffer, not char[size]. --- diff --git a/clients/tools/common.c b/clients/tools/common.c index 4f38ede9fd..58d5e6bf49 100644 --- a/clients/tools/common.c +++ b/clients/tools/common.c @@ -1583,8 +1583,8 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count ) #endif if ( preread ) { - char berbuf[LBER_ELEMENT_SIZEOF]; - BerElement *ber = (BerElement *)berbuf; + BerElementBuffer berbuf; + BerElement *ber = (BerElement *)&berbuf; char **attrs = NULL; if( preread_attrs ) { @@ -1613,8 +1613,8 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count ) } if ( postread ) { - char berbuf[LBER_ELEMENT_SIZEOF]; - BerElement *ber = (BerElement *)berbuf; + BerElementBuffer berbuf; + BerElement *ber = (BerElement *)&berbuf; char **attrs = NULL; if( postread_attrs ) { diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index 17f90fa17b..54607e2e81 100644 --- a/servers/slapd/overlays/ppolicy.c +++ b/servers/slapd/overlays/ppolicy.c @@ -364,8 +364,8 @@ static const char ppolicy_ctrl_oid[] = LDAP_CONTROL_PASSWORDPOLICYRESPONSE; static LDAPControl * create_passcontrol( Operation *op, int exptime, int grace, LDAPPasswordPolicyError err ) { - char berbuf[LBER_ELEMENT_SIZEOF], bb2[LBER_ELEMENT_SIZEOF]; - BerElement *ber = (BerElement *)berbuf, *b2 = (BerElement *)bb2; + BerElementBuffer berbuf, bb2; + BerElement *ber = (BerElement *) &berbuf, *b2 = (BerElement *) &bb2; LDAPControl c = { 0 }, *cp; struct berval bv;