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

Re: (ITS#4436) Freeing invalid pointer - GLIBC 2.4




--On Tuesday, March 14, 2006 4:35 PM +0000 netolicky@epos.cd.cz wrote:

> Full_Name: Jiri Netolicky
> Version: 2.2.28-r4
> OS: Gentoo 2006.0
> URL:
> Submission from: (NULL) (82.117.130.2)
>
>
> To day I have upgraded GLIBC into 2.4 version. All ldap client utils
> stops work. Glibc wrote message like:
> *** glibc detected *** ldapmodify: munmap_chunk(): invalid pointer:
> 0xbfc11582 ***
>
> I am using param SASL_AUTHCID in my .ldaprc. The problem is in init.c
> line 556. There is fill
>
> gopts->ldo_def_sasl_authcid = user
>
> where the user is DIRECTLY from getenv("USER").
>
> After that when is readed .ldaprc in function openldap_ldap_init_w_conf,
> the sasl_authcid is freed when it's not null. But freeing strings from
> getenv seems to be checked in new version of GLIBC.
> I think the best solution will be make a copy of user name like this:
>
> gopts->ldo_def_sasl_authcid = LDAP_STRDUP(user);
>
> After this small patch works everything fine.
>
> --- openldap-2.2.28/libraries/libldap/init.c    2005-01-20
> 18:01:01.000000000 +0100
> +++ openldap-2.2.28-patch/libraries/libldap/init.c      2006-03-14
> 17:17:13.000000000 +0100
> @@ -553,7 +553,7 @@
>                 if( user == NULL ) user = getenv("LOGNAME");
>
>                 if( user != NULL ) {
> -                       gopts->ldo_def_sasl_authcid = user;
> +                       gopts->ldo_def_sasl_authcid = LDAP_STRDUP(user);
>                 }
>      }
>  #endif


This code is still present in HEAD and 2.3, so it probably should be fixed 
there (sine this was written against 2.2.28)

--Quanah

--
Quanah Gibson-Mount
Principal Software Developer
ITS/Shared Application Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html