Avoid parsing large sizes for messages

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2020-06-01 15:59:41 -07:00
parent f8d6dd992b
commit 07ef71ff98
3 changed files with 14 additions and 2 deletions

View File

@@ -225,6 +225,16 @@ func TestParsePub(t *testing.T) {
}
}
// https://www.twistlock.com/labs-blog/finding-dos-vulnerability-nats-go-fuzz-cve-2019-13126/
func TestParsePubSizeOverflow(t *testing.T) {
c := dummyClient()
pub := []byte("PUB foo 3333333333333333333333333333333333333333333333333333333333333333\r\n")
if err := c.parse(pub); err == nil {
t.Fatalf("Expected an error")
}
}
func TestParsePubArg(t *testing.T) {
c := dummyClient()