mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 03:30:35 +00:00
ethstats: set readlimit on ethstats server connection (#26207)
This prevents DoS when connected to a malicious ethstats server.
This commit is contained in:
parent
97c563e055
commit
c2e0abce2e
@ -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}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user