Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3604edc

Browse files
authored
Merge pull request#291 from nhooyr/dos-56b8
Fix DOS attack from malicious pongs
2 parentse4c3b0f +b0d7a27 commit3604edc

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

‎ci/container/Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ RUN go get golang.org/x/tools/cmd/stringer
1010
RUN go get golang.org/x/lint/golint
1111
RUN go get github.com/agnivade/wasmbrowsertest
1212

13-
RUN npm install -g prettier
14-
RUN npm install -g netlify-cli
13+
RUN npm--unsafe-perm=trueinstall -g prettier
14+
RUN npm--unsafe-perm=trueinstall -g netlify-cli

‎conn_notjs.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func (c *Conn) Ping(ctx context.Context) error {
189189
}
190190

191191
func (c*Conn)ping(ctx context.Context,pstring)error {
192-
pong:=make(chanstruct{})
192+
pong:=make(chanstruct{},1)
193193

194194
c.activePingsMu.Lock()
195195
c.activePings[p]=pong

‎read.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,10 @@ func (c *Conn) handleControl(ctx context.Context, h header) (err error) {
271271
pong,ok:=c.activePings[string(b)]
272272
c.activePingsMu.Unlock()
273273
ifok {
274-
close(pong)
274+
select {
275+
casepong<-struct{}{}:
276+
default:
277+
}
275278
}
276279
returnnil
277280
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp