mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
ITS#6733: Fix LDAP_MEMORY_DEBUG issues.
ber_memcalloc_x overflow check. Silence some compiler warnings.
This commit is contained in:
parent
6be3671985
commit
a55d333107
1 changed files with 5 additions and 3 deletions
|
|
@ -62,9 +62,9 @@ struct ber_mem_hdr {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Pattern at top of allocated space */
|
/* Pattern at top of allocated space */
|
||||||
#define LBER_MEM_JUNK 0xdeaddadaU
|
#define LBER_MEM_JUNK ((ber_int_t) 0xdeaddada)
|
||||||
|
|
||||||
static const struct ber_mem_hdr ber_int_mem_hdr = { LBER_MEM_JUNK, 0, 0 };
|
static const struct ber_mem_hdr ber_int_mem_hdr = { LBER_MEM_JUNK };
|
||||||
|
|
||||||
/* Note sequence and ber_int_meminuse are counters, but are not
|
/* Note sequence and ber_int_meminuse are counters, but are not
|
||||||
* thread safe. If you want to use these values for multithreaded applications,
|
* thread safe. If you want to use these values for multithreaded applications,
|
||||||
|
|
@ -256,7 +256,9 @@ ber_memcalloc_x( ber_len_t n, ber_len_t s, void *ctx )
|
||||||
|
|
||||||
if( ber_int_memory_fns == NULL || ctx == NULL ) {
|
if( ber_int_memory_fns == NULL || ctx == NULL ) {
|
||||||
#ifdef LDAP_MEMORY_DEBUG
|
#ifdef LDAP_MEMORY_DEBUG
|
||||||
new = calloc(1, n*s + sizeof(struct ber_mem_hdr) + sizeof(ber_int_t));
|
new = n < (-sizeof(struct ber_mem_hdr) - sizeof(ber_int_t)) / s
|
||||||
|
? calloc(1, n*s + sizeof(struct ber_mem_hdr) + sizeof(ber_int_t))
|
||||||
|
: NULL;
|
||||||
if( new )
|
if( new )
|
||||||
{
|
{
|
||||||
struct ber_mem_hdr *mh = new;
|
struct ber_mem_hdr *mh = new;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue