haproxy-spoe-go
haproxy-spoe-go copied to clipboard
Wrong encoding of bool value
Encoder doesn't set boolean data type in the buffer when the value being encoded is false: https://github.com/negasus/haproxy-spoe-go/blob/9a8c9fb7e70ae4fc3db768cdaaf84a1ff3210e84/typeddata/typeddata.go#L51-L57
False value should be 0x01
, not 0x10
as it's set currently.
According with section 3.1 of the documentation https://www.haproxy.org/download/1.9/doc/SPOE.txt, bool type has format: Type (4 bit) and Flag (4 bit).
Maybe I should check it out if I misunderstood?
Quoted code transforms the true value to 0x11 which is correct: flags (higher 4 bits) are 0001 and type (lower 4 bits) is 0001 but the false value is transformed to 0x10 which is wrong: flags are 0001 and type is 0000 but should be vice versa.