cloudflare / keyless

Cloudflare's Keyless SSL Server Reference Implementation
Other
276 stars 78 forks source link

Bug in length of PADDING items? #79

Closed dgryski closed 9 years ago

dgryski commented 9 years ago

Hi,

I'm implementing the client protocol in Go ( https://github.com/dgryski/go-keyless ) and I think I've found a bug in how size is calculated for padding items. It doesn't appear to take into account the item header size. So, when I'm unmarshaling padding items, I have to check the tag and adjust the length down by 3 in order not to overrun the buffer.

https://github.com/dgryski/go-keyless/blob/d5fa5dfa4a03d873b78f312331f4d8722d1e73cc/keyless.go#L164

dgryski commented 9 years ago

Hrm, looks like I was doing a short read. I was only reading 1024 bytes, and there were still 3 in the buffer. So, the total size of the ping packet is 1027 bytes, instead of nicely fitting in 1k which I thought was the point of the padding.