[Date Prev][Date Next] [Chronological] [Thread] [Top]

A new allocation of size 0 (as in #1931) (ITS#1946)

Full_Name: Xaveir REDON
Version: 2.1.2
OS: Linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

This issue is similar to #1931.
In servers/slapd/results.c at line 735 an allocation of size 0 can occurs :

e_flags = ch_malloc ( i * sizeof(a_flags) );

It suffices that i=0 (no attribute to return) to make the assertion fail
in ch_malloc.

I remplaced this line in my copy of openldap by:

e_flags = i==0 ? NULL : ch_malloc ( i * sizeof(a_flags) );

Thanks for the correction of #1931