diff options
| author | Shulhan <ms@kilabit.info> | 2019-03-11 16:29:58 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2019-03-11 16:29:58 +0700 |
| commit | d93d9a46bca9f5be65cbfadbd1b59f7d0900ea02 (patch) | |
| tree | 43ad3a3a2ed67699c742b3b86847255af04d201c /lib/websocket/server.go | |
| parent | ac86d5118bfd8dcff10df836a3bbec4d0823d15a (diff) | |
| download | pakakeh.go-d93d9a46bca9f5be65cbfadbd1b59f7d0900ea02.tar.xz | |
websocket: handle non-zero opcode on continuous frame
If a connection have continuous frame, the next frame opcode must be 0
or it will be considering invalid frame and server will close the
connection.
Diffstat (limited to 'lib/websocket/server.go')
| -rw-r--r-- | lib/websocket/server.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/websocket/server.go b/lib/websocket/server.go index aa45aa5c..f4936216 100644 --- a/lib/websocket/server.go +++ b/lib/websocket/server.go @@ -442,6 +442,12 @@ func (serv *Server) handleFragment(conn int, req *Frame) (isInvalid bool) { if frame == nil { frame = req } else { + // If a connection have continuous frame, the next frame + // opcode must be 0. + if req.opcode != opcodeCont { + return true + } + frame.payload = append(frame.payload, req.payload...) if req.len > 0 { frame.len += req.len |
