inejge / ldap3

A pure-Rust LDAP library using the Tokio stack
Apache License 2.0
220 stars 38 forks source link

The most significant bit in a INTEGER is always 0 #22

Closed sindreij closed 6 years ago

sindreij commented 6 years ago

When the number is positive.

If a INTEGER is only decoded with 8 bits one octet, and the msb of that octet is 1, AD reads this as a signed integer, and will therefore read a negative number.

This fixes that by incrementing the number of octets in a integer if the msb is 1 and the number is positive.

Fixes #21

(I also fixed a few tests that failed)

inejge commented 6 years ago

Thanks for the PR! ASN.1 code has been left mostly untouched since the fork from the original project, and this kind of practical testing is very helpful in shaking out the bugs. LGTM, so I'm merging it.