--- libraries/liblber/decode.c 2001/07/21 21:13:05 1.61 +++ libraries/liblber/decode.c 2001/11/03 21:07:41 1.62 @@ -1,5 +1,5 @@ /* decode.c - ber input decoding routines */ -/* $OpenLDAP: pkg/ldap/libraries/liblber/decode.c,v 1.60 2001/05/06 17:07:24 kurt Exp $ */ +/* $OpenLDAP: pkg/ldap/libraries/liblber/decode.c,v 1.61 2001/07/21 21:13:05 kurt Exp $ */ /* * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file @@ -590,9 +590,17 @@ ber_scanf ( BerElement *ber, tag != LBER_DEFAULT && rc != LBER_DEFAULT; tag = ber_next_element( ber, &len, last ) ) { + void *save = *sss; + *sss = (char **) LBER_REALLOC( *sss, (j + 2) * sizeof(char *) ); + if( *sss == NULL ) { + LBER_MEMFREE( save ); + rc = LBER_DEFAULT; + goto breakout; + } + rc = ber_get_stringa( ber, &((*sss)[j]) ); j++; } @@ -608,9 +616,17 @@ ber_scanf ( BerElement *ber, tag != LBER_DEFAULT && rc != LBER_DEFAULT; tag = ber_next_element( ber, &len, last ) ) { + void *save = *bv; + *bv = (struct berval **) LBER_REALLOC( *bv, (j + 2) * sizeof(struct berval *) ); + if( *bv == NULL ) { + LBER_MEMFREE( save ); + rc = LBER_DEFAULT; + goto breakout; + } + rc = ber_get_stringal( ber, &((*bv)[j]) ); j++; } @@ -649,6 +665,7 @@ ber_scanf ( BerElement *ber, } } +breakout: va_end( ap ); if ( rc == LBER_DEFAULT ) {