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

Re: ber_flatten() of incomplete ber



masarati@aero.polimi.it writes:
> I was encoding a ber of the form "{{something}" (note the missing "}")
> using HEAD's liblber.  ber_flatten() was (correctly?) returning an empty
> value; perhaps it should return an error code, indicating that the ber is
> incomplete?  Am I missing some function to test the validity of a ber?

I think this'll do it, but OpenLDAP is a a bit too smart about ber
sometimes so I wouldn't trust it without testing.  I suggest you run
make test, remove anything that causes the assert, then remove the
assert and commit.  I'm a bit busy with other things at the moment...

--- libraries/liblber/io.c	2010-11-24 15:03:07.000000000 +0100
+++ libraries/liblber/io.c	2010-12-31 11:06:58.899323000 +0100
@@ -387,5 +387,6 @@ int ber_flatten2(
 	assert( bv != NULL );
 
-	if ( bv == NULL ) {
+	if ( bv == NULL || ber->ber_sos_ptr != NULL ) {
+		assert( ber->ber_sos_ptr != NULL ); /* For debugging */
 		return -1;
 	}

-- 
Hallvard