Skip to content

MaxPayload size is ignored #95

Closed
Closed
@dgryski

Description

@dgryski

The max_payload configuration option is ignored when parsing.

This opens up two DoS vectors that cause crashes in gnatsd.

  1. PUB o 680444720440
    produces the following panic() output:
panic: runtime error: makeslice: cap out of range

goroutine 9 [running]:
github.com/nats-io/gnatsd/server.(*client).parse(0xc820132000, 0xc82013c000, 0x13, 0x8000, 0x0, 0x0)
    /home/dgryski/work/src/cvs/gocode/src/github.com/nats-io/gnatsd/server/parser.go:630 +0x291
github.com/nats-io/gnatsd/server.(*client).readLoop(0xc820132000)
    /home/dgryski/work/src/cvs/gocode/src/github.com/nats-io/gnatsd/server/client.go:155 +0x194
created by github.com/nats-io/gnatsd/server.(*client).initClient
    /home/dgryski/work/src/cvs/gocode/src/github.com/nats-io/gnatsd/server/client.go:133 +0x782

and 2) PUB 0 8000000000

produces an out-of-memory error on the same line

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions