reject NEW_TOKEN frames with empty tokens

This commit is contained in:
Marten Seemann
2019-09-13 11:00:06 +07:00
parent 9839669f3b
commit 2ea8b70ffb
3 changed files with 13 additions and 1 deletions

View File

@@ -24,6 +24,14 @@ var _ = Describe("NEW_TOKEN frame", func() {
Expect(b.Len()).To(BeZero())
})
It("rejects empty tokens", func() {
data := []byte{0x7}
data = append(data, encodeVarInt(uint64(0))...)
b := bytes.NewReader(data)
_, err := parseNewTokenFrame(b, protocol.VersionWhatever)
Expect(err).To(MatchError("Token must not be empty."))
})
It("errors on EOFs", func() {
token := "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
data := []byte{0x7}