Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

garbage input crashes doozerd #30

Open
beaufour opened this issue Apr 11, 2012 · 2 comments
Open

garbage input crashes doozerd #30

beaufour opened this issue Apr 11, 2012 · 2 comments
Labels

Comments

@beaufour
Copy link

Steps to Reproduce

$ ./doozerd &
$ echo foo | nc localhost 8046

Result

doozerd crashes here:

throw: runtime: out of memory
goroutine 26 [running]:
github.com/ha/doozerd/server.(*conn).read(0xf8400dfa00, 0xf840142008, 0xf800000000, 0x7f8ef9422f70, 0x51d0ee, ...)
    /home/ubuntu/doozer_compile/src/github.com/ha/doozerd/server/conn.go:50 +0x220
github.com/ha/doozerd/server.(*conn).serve(0xf8400dfa00, 0x67cb94)
    /home/ubuntu/doozer_compile/src/github.com/ha/doozerd/server/conn.go:31 +0x4a
github.com/ha/doozerd/server.serve(0xf84007a3c0, 0xf84008c590, 0xf840000690, 0xf8400d5300, 0xf8400bc6a0, ...)
    /home/ubuntu/doozer_compile/src/github.com/ha/doozerd/server/server.go:52 +0x191
created by github.com/ha/doozerd/server.ListenAndServe
    /home/ubuntu/doozer_compile/src/github.com/ha/doozerd/server/server.go:35 +0x342

The reason is that this:

err := binary.Read(c.c, binary.BigEndian, &size)
buf := make([]byte, size)

returns a very big size from Read in this case (hence the oom)

@bketelsen
Copy link
Member

Is this still a valid issue?

@mreiferson
Copy link
Contributor

yes, but there are a variety of ways you could imagine resolving it.

for example, the daemon can (somewhat) protect itself if we bound the size of a doozer command (in bytes)

@ghost ghost assigned mreiferson Mar 11, 2013
@mreiferson mreiferson removed their assignment Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants