mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
Initial fix for berbuf alignment bug (ITS#2760)
Needs to be applied to other stack allocated berbufs.
This commit is contained in:
parent
d03c83f077
commit
767cf365ea
@ -158,6 +158,17 @@ extern char ber_pvt_opt_on;
|
||||
#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;
|
||||
|
@ -83,8 +83,8 @@ int slap_passwd_parse( struct berval *reqdata,
|
||||
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;
|
||||
@ -224,9 +224,9 @@ struct berval * slap_passwd_return(
|
||||
{
|
||||
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 );
|
||||
|
||||
|
@ -223,8 +223,8 @@ send_ldap_response(
|
||||
Operation *op,
|
||||
SlapReply *rs )
|
||||
{
|
||||
char berbuf[LBER_ELEMENT_SIZEOF];
|
||||
BerElement *ber = (BerElement *)berbuf;
|
||||
BerElementBuffer berbuf;
|
||||
BerElement *ber = (BerElement *) &berbuf;
|
||||
int rc;
|
||||
long bytes;
|
||||
|
||||
@ -602,8 +602,8 @@ slap_send_ldap_intermediate( Operation *op, SlapReply *rs )
|
||||
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;
|
||||
@ -1193,8 +1193,8 @@ error_return:;
|
||||
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;
|
||||
@ -1437,8 +1437,8 @@ int slap_read_controls(
|
||||
{
|
||||
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;
|
||||
|
@ -28,8 +28,8 @@ str2filter_x( Operation *op, const char *str )
|
||||
{
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user