Commit 6553ebfd authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

ITS#6732

parent 9dee7c4d
......@@ -9,6 +9,7 @@ OpenLDAP 2.4.24 Engineering
Added slapd-sql autocommit support (ITS#6612)
Added slapd-sql support for long long keys (ITS#6617)
Fixed liblber to not close invalid sockets (ITS#6585)
Fixed liblber error setting (ITS#6732)
Fixed libldap dnssrv port format specifier (ITS#6644)
Fixed libldap EOF handling (ITS#6723)
Fixed libldap GnuTLS hang on socket close (ITS#6673)
......
......@@ -201,9 +201,10 @@ ber_memalloc_x( ber_len_t s, void *ctx )
if( ber_int_memory_fns == NULL || ctx == NULL ) {
#ifdef LDAP_MEMORY_DEBUG
struct ber_mem_hdr *mh = malloc(s + sizeof(struct ber_mem_hdr) + sizeof( ber_int_t));
if( mh == NULL ) return NULL;
new = malloc(s + sizeof(struct ber_mem_hdr) + sizeof( ber_int_t));
if( new )
{
struct ber_mem_hdr *mh = new;
mh->bm_top = LBER_MEM_JUNK;
mh->bm_length = s;
setdatatop( mh);
......@@ -222,6 +223,7 @@ ber_memalloc_x( ber_len_t s, void *ctx )
BER_MEM_VALID( &mh[1] );
new = &mh[1];
}
#else
new = malloc( s );
#endif
......@@ -254,9 +256,10 @@ ber_memcalloc_x( ber_len_t n, ber_len_t s, void *ctx )
if( ber_int_memory_fns == NULL || ctx == NULL ) {
#ifdef LDAP_MEMORY_DEBUG
struct ber_mem_hdr *mh = calloc(1,
(n * s) + sizeof(struct ber_mem_hdr) + sizeof(ber_int_t) );
if( mh == NULL ) return NULL;
new = calloc(1, n*s + sizeof(struct ber_mem_hdr) + sizeof(ber_int_t));
if( new )
{
struct ber_mem_hdr *mh = new;
mh->bm_top = LBER_MEM_JUNK;
mh->bm_length = n*s;
......@@ -273,6 +276,7 @@ ber_memcalloc_x( ber_len_t n, ber_len_t s, void *ctx )
#endif
BER_MEM_VALID( &mh[1] );
new = &mh[1];
}
#else
new = calloc( n, s );
#endif
......@@ -487,7 +491,6 @@ ber_dupbv_x(
new = dst;
} else {
if(( new = ber_memalloc_x( sizeof(struct berval), ctx )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
return NULL;
}
}
......@@ -499,7 +502,6 @@ ber_dupbv_x(
}
if(( new->bv_val = ber_memalloc_x( src->bv_len + 1, ctx )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
if ( !dst )
ber_memfree_x( new, ctx );
return NULL;
......@@ -542,7 +544,6 @@ ber_str2bv_x(
new = bv;
} else {
if(( new = ber_memalloc_x( sizeof(struct berval), ctx )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
return NULL;
}
}
......@@ -550,7 +551,6 @@ ber_str2bv_x(
new->bv_len = len ? len : strlen( s );
if ( dup ) {
if ( (new->bv_val = ber_memalloc_x( new->bv_len+1, ctx )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
if ( !bv )
ber_memfree_x( new, ctx );
return NULL;
......@@ -588,7 +588,6 @@ ber_mem2bv_x(
new = bv;
} else {
if(( new = ber_memalloc_x( sizeof(struct berval), ctx )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
return NULL;
}
}
......@@ -596,7 +595,6 @@ ber_mem2bv_x(
new->bv_len = len;
if ( dup ) {
if ( (new->bv_val = ber_memalloc_x( new->bv_len+1, ctx )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
if ( !bv ) {
ber_memfree_x( new, ctx );
}
......@@ -635,13 +633,10 @@ ber_strdup_x( LDAP_CONST char *s, void *ctx )
}
len = strlen( s ) + 1;
if ( (p = ber_memalloc_x( len, ctx )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
return NULL;
if ( (p = ber_memalloc_x( len, ctx )) != NULL ) {
AC_MEMCPY( p, s, len );
}
AC_MEMCPY( p, s, len );
return p;
}
......@@ -677,14 +672,11 @@ ber_strndup_x( LDAP_CONST char *s, ber_len_t l, void *ctx )
}
len = ber_strnlen( s, l );
if ( (p = ber_memalloc_x( len + 1, ctx )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
return NULL;
if ( (p = ber_memalloc_x( len + 1, ctx )) != NULL ) {
AC_MEMCPY( p, s, len );
p[len] = '\0';
}
AC_MEMCPY( p, s, len );
p[len] = '\0';
return p;
}
......
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