Needs to be applied to other stack allocated berbufs.
#define LBER_OPT_ERROR (-1)
#define LBER_ELEMENT_SIZEOF (256) /* must be >= sizeof(BerElement) */
+typedef union ber_buffer_u {
+ char charbuf[LBER_ELEMENT_SIZEOF];
+
+ /* force alignment */
+ int intbuf;
+ long longbuf;
+ float floatbuf;
+ double doublebuf;
+ char* ptrbuf;
+} BerElementBuffer;
+
typedef struct berelement BerElement;
typedef struct sockbuf Sockbuf;
typedef struct seqorset Seqorset;
int rc = LDAP_SUCCESS;
ber_tag_t tag;
ber_len_t len;
- char berbuf[LBER_ELEMENT_SIZEOF];
- BerElement *ber = (BerElement *)berbuf;
+ BerElementBuffer berbuf;
+ BerElement *ber = (BerElement *)&berbuf;
if( reqdata == NULL ) {
return LDAP_SUCCESS;
{
int rc;
struct berval *bv = NULL;
- char berbuf[LBER_ELEMENT_SIZEOF];
+ BerElementBuffer berbuf;
/* opaque structure, size unknown but smaller than berbuf */
- BerElement *ber = (BerElement *)berbuf;
+ BerElement *ber = (BerElement *)&berbuf;
assert( cred != NULL );
Operation *op,
SlapReply *rs )
{
- char berbuf[LBER_ELEMENT_SIZEOF];
- BerElement *ber = (BerElement *)berbuf;
+ BerElementBuffer berbuf;
+ BerElement *ber = (BerElement *) &berbuf;
int rc;
long bytes;
int
slap_send_search_entry( Operation *op, SlapReply *rs )
{
- char berbuf[LBER_ELEMENT_SIZEOF];
- BerElement *ber = (BerElement *)berbuf;
+ BerElementBuffer berbuf;
+ BerElement *ber = (BerElement *) &berbuf;
Attribute *a, *aa;
int i, j, rc=-1, bytes;
char *edn;
int
slap_send_search_reference( Operation *op, SlapReply *rs )
{
- char berbuf[LBER_ELEMENT_SIZEOF];
- BerElement *ber = (BerElement *)berbuf;
+ BerElementBuffer berbuf;
+ BerElement *ber = (BerElement *) &berbuf;
int rc = 0;
int bytes;
void *mark;
{
int rc;
struct berval bv;
- char berbuf[LBER_ELEMENT_SIZEOF];
- BerElement *ber = (BerElement *) berbuf;
+ BerElementBuffer berbuf;
+ BerElement *ber = (BerElement *) &berbuf;
LDAPControl c;
ber_len_t siz, len;
Operation myop;
{
int rc;
Filter *f = NULL;
- char berbuf[LBER_ELEMENT_SIZEOF];
- BerElement *ber = (BerElement *)berbuf;
+ BerElementBuffer berbuf;
+ BerElement *ber = (BerElement *)&berbuf;
const char *text = NULL;
#ifdef NEW_LOGGING