Commit f178305a authored by alexstocks's avatar alexstocks

add remark

parent b11bcf8e
...@@ -132,6 +132,7 @@ func (this *EchoPackage) Unmarshal(buf *bytes.Buffer) (int, error) { ...@@ -132,6 +132,7 @@ func (this *EchoPackage) Unmarshal(buf *bytes.Buffer) (int, error) {
if buf.Len() < (int)(this.H.Len) { if buf.Len() < (int)(this.H.Len) {
return 0, ErrNotEnoughSteam return 0, ErrNotEnoughSteam
} }
// 防止恶意客户端把这个字段设置过大导致服务端死等或者服务端在准备对应的缓冲区时内存崩溃
if maxEchoStringLen < this.H.Len { if maxEchoStringLen < this.H.Len {
return 0, ErrTooLargePackage return 0, ErrTooLargePackage
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment