mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Fix realloc bug (ITS#1410)
This commit is contained in:
parent
b312488614
commit
9bd4308edf
@ -590,9 +590,17 @@ ber_scanf ( BerElement *ber,
|
|||||||
tag != LBER_DEFAULT && rc != LBER_DEFAULT;
|
tag != LBER_DEFAULT && rc != LBER_DEFAULT;
|
||||||
tag = ber_next_element( ber, &len, last ) )
|
tag = ber_next_element( ber, &len, last ) )
|
||||||
{
|
{
|
||||||
|
void *save = *sss;
|
||||||
|
|
||||||
*sss = (char **) LBER_REALLOC( *sss,
|
*sss = (char **) LBER_REALLOC( *sss,
|
||||||
(j + 2) * sizeof(char *) );
|
(j + 2) * sizeof(char *) );
|
||||||
|
|
||||||
|
if( *sss == NULL ) {
|
||||||
|
LBER_MEMFREE( save );
|
||||||
|
rc = LBER_DEFAULT;
|
||||||
|
goto breakout;
|
||||||
|
}
|
||||||
|
|
||||||
rc = ber_get_stringa( ber, &((*sss)[j]) );
|
rc = ber_get_stringa( ber, &((*sss)[j]) );
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
@ -608,9 +616,17 @@ ber_scanf ( BerElement *ber,
|
|||||||
tag != LBER_DEFAULT && rc != LBER_DEFAULT;
|
tag != LBER_DEFAULT && rc != LBER_DEFAULT;
|
||||||
tag = ber_next_element( ber, &len, last ) )
|
tag = ber_next_element( ber, &len, last ) )
|
||||||
{
|
{
|
||||||
|
void *save = *bv;
|
||||||
|
|
||||||
*bv = (struct berval **) LBER_REALLOC( *bv,
|
*bv = (struct berval **) LBER_REALLOC( *bv,
|
||||||
(j + 2) * sizeof(struct berval *) );
|
(j + 2) * sizeof(struct berval *) );
|
||||||
|
|
||||||
|
if( *bv == NULL ) {
|
||||||
|
LBER_MEMFREE( save );
|
||||||
|
rc = LBER_DEFAULT;
|
||||||
|
goto breakout;
|
||||||
|
}
|
||||||
|
|
||||||
rc = ber_get_stringal( ber, &((*bv)[j]) );
|
rc = ber_get_stringal( ber, &((*bv)[j]) );
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
@ -649,6 +665,7 @@ ber_scanf ( BerElement *ber,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
breakout:
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
if ( rc == LBER_DEFAULT ) {
|
if ( rc == LBER_DEFAULT ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user