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

lber etest.c bitstring broken

The ber_put_bitstring routine expects a buffer of packed bits as input. The
etest.c program is using strlen() on its input buffer, and passing this
length (number of bytes) to ber_printf. It should be passing a number of
bits. I'm not sure how things are intended to work with these test programs,
but certainly etest output piped to dtest will fail for bitstrings. (And the
other way around as well.) Likewise, using etest with octet strings will
fail if the input string contains any NUL characters, because it uses
strlen() to compute the buffer length.

It's also not clear that bitstring decoding is entirely correct - the string
extracted from the ber buffer is passed back unmodified. It might be nice to
explicitly mask off the trailing unused bits, and force them to zero.

Any comments? Is this important enough to look into and fix?