pellegre / libcrafter

A high level C++ network packet sniffing and crafting library.
298 stars 88 forks source link

Critical -- BitsField: Correctly read/write multiple-bytes bits #13

Closed oliviertilmans closed 9 years ago

oliviertilmans commented 9 years ago

The previous code was failing e.g on reading a 0 in a bitsfield of size 3, with starting bit 7 in the following bit sequence: 0100 0000 0000 0000 ^ ^ | +---+ start | stop The high/low mask were not applied (and computed as the opposite)

oliviertilmans commented 9 years ago

Just noticed I broke the patch when cleaning up commit history, will redo asap

oliviertilmans commented 9 years ago

Added the missing part. Apply the mask to the value we're pushing in the raw_data, and not on the raw_data itself. Fixed masking negation.