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

perl-back segfault (ITS#1842)



Full_Name: Kervin Pierre
Version: CVS
OS: win2k
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (163.118.3.50)


The crash occurs because a NULL pointer is being pushed on the perl
argument stack in servers/slapd/back-perl/modify.c .  The NULL pointer is the
mods->sm_type.bv_val value which is NULL presumably because the attribute does
not have a name but seems to have a value.


...
XPUSHs(sv_2mortal(newSVpv( mods->sm_type.bv_val, 0 )));
...

At this point mods->sm_type.bv_val is a NULL pointer.


This occurs when some type of hidden timestamp attribute is being pushed
on the perl function arguement stack.

mods->sm_bvalues.bv_val is "2002042418:30:14Z#0x0001#0#0000"
but mods->sm_type.bv_val is NULL.


I'm guessing that this hidden attribute should be given a name before
being pushed on the perl function arguement stack?

to fix this I decided not to try to put any attributes without a name onto the
perl stack by testing the val of sm_type.bv_val right before it is inserted, but
I am not sure that is correct.  Another option is to give these attributes a
default name eg. "<unknown>" or something before pushing them on the perl
arguement stack.


/* Make sure the attribute has a nme before sending it to the */
/* backend */
if( mods->sm_type.bv_val && strlen(mods->sm_type.bv_val)>0 )
{
    XPUSHs(sv_2mortal(newSVpv( mods->sm_type.bv_val, 0 )));
    for ( i = 0;
        mods->sm_bvalues != NULL && mods->sm_bvalues[i].bv_val != NULL;
        i++ )
    {
         XPUSHs(sv_2mortal(newSVpv( mods->sm_bvalues[i].bv_val, 0 )));
    }
}