aboutsummaryrefslogtreecommitdiff
path: root/lib/websocket
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-03-06 14:21:56 +0700
committerShulhan <ms@kilabit.info>2019-03-06 14:22:46 +0700
commit78a7750f17771ef9cd74e262a55871b59e89c2aa (patch)
tree1c045035999b0fc73b1107ddff0a48384bfcb61b /lib/websocket
parent3164b63104c3477045903d7feb1f3a2b73be4ab1 (diff)
downloadpakakeh.go-78a7750f17771ef9cd74e262a55871b59e89c2aa.tar.xz
websocket: read close code only if payload length is not zero
Diffstat (limited to 'lib/websocket')
-rw-r--r--lib/websocket/frame.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/websocket/frame.go b/lib/websocket/frame.go
index c151486d..95efd0cc 100644
--- a/lib/websocket/frame.go
+++ b/lib/websocket/frame.go
@@ -260,7 +260,7 @@ func frameUnpack(in []byte) (f *Frame, x uint64) {
}
x += f.len
- if f.opcode == opcodeClose {
+ if f.opcode == opcodeClose && f.len > 0 {
f.closeCode = CloseCode(binary.BigEndian.Uint16(f.payload[0:2]))
f.payload = f.payload[2:]
}