manage invalid error code (size=1) and too long reason (size>125)
This commit is contained in:
parent
ec1722a804
commit
f07afb8c85
14
ws/client.go
14
ws/client.go
|
@ -156,12 +156,14 @@ func clientReader(c *client){
|
||||||
|
|
||||||
/* (4) CLOSE */
|
/* (4) CLOSE */
|
||||||
if msg.Type == CLOSE {
|
if msg.Type == CLOSE {
|
||||||
// fmt.Printf(" [reader] CLOSE ; size %d\n", msg.Size)
|
// uncomplete code || too long
|
||||||
// if msg.Size >= 2 {
|
if msg.Size == 1 || msg.Size > 125 {
|
||||||
// errCode := binary.BigEndian.Uint16(msg.Data[0:2])
|
errorCode = PROTOCOL_ERR
|
||||||
// fmt.Printf(" ; status %d\n", errCode)
|
}
|
||||||
// fmt.Printf(" ; msg '%s'\n", msg.Data[2:])
|
// invalid utf-8 reason
|
||||||
// }
|
if msg.Size > 2 && !utf8.Valid(msg.Data[2:]) {
|
||||||
|
errorCode = INVALID_PAYLOAD
|
||||||
|
}
|
||||||
clientAck = false
|
clientAck = false
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue