Skip to content

Commit c2e0abc

Browse files
authored
ethstats: set readlimit on ethstats server connection (#26207)
This prevents DoS when connected to a malicious ethstats server.
1 parent 97c563e commit c2e0abc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ethstats/ethstats.go

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ const (
5757
txChanSize = 4096
5858
// chainHeadChanSize is the size of channel listening to ChainHeadEvent.
5959
chainHeadChanSize = 10
60+
61+
messageSizeLimit = 15 * 1024 * 1024
6062
)
6163

6264
// backend encompasses the bare-minimum functionality needed for ethstats reporting
@@ -121,6 +123,7 @@ type connWrapper struct {
121123
}
122124

123125
func newConnectionWrapper(conn *websocket.Conn) *connWrapper {
126+
conn.SetReadLimit(messageSizeLimit)
124127
return &connWrapper{conn: conn}
125128
}
126129

0 commit comments

Comments
 (0)