ando@sys-net.it wrote:
I'm trying to modify the code in order to compute the size of the SearchResultEntry portion of the message, but again, in some cases, the size is computed incorrectly: the computed length is 4 octets shorter than what's actually in the packet.
One issue seems to be related to the fact that when ber_skip_tag() checks if the length it's computed fits in the ber by calling ber_pvt_ber_remaining(), it doesn't count that earlier calls to ber_read() moved the ber_ptr forward. The original ber_ptr should be saved.
This sounds wrong; the bytes that ber_read() advanced comprise the length bytes, but they're not included in the total that the length is counting. Therefore they should not be accounted for here.
I don't believe messages are encoded incorrectly, so I must be doing something wrong in decoding them...