Unverified Commit c2e0abce authored by Martin Holst Swende's avatar Martin Holst Swende Committed by GitHub

ethstats: set readlimit on ethstats server connection (#26207)

This prevents DoS when connected to a malicious ethstats server.
parent 97c563e0
......@@ -57,6 +57,8 @@ const (
txChanSize = 4096
// chainHeadChanSize is the size of channel listening to ChainHeadEvent.
chainHeadChanSize = 10
messageSizeLimit = 15 * 1024 * 1024
)
// backend encompasses the bare-minimum functionality needed for ethstats reporting
......@@ -121,6 +123,7 @@ type connWrapper struct {
}
func newConnectionWrapper(conn *websocket.Conn) *connWrapper {
conn.SetReadLimit(messageSizeLimit)
return &connWrapper{conn: conn}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment