Skip to content

Commit

Permalink
vmess: fix aead painc #301 (ref: #302) optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
nadoo committed Dec 25, 2021
1 parent e3f7555 commit 40f75ef
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions proxy/vmess/aead.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (r *aeadReader) read(p []byte) (int, error) {
return 0, err
}

if int(size) > len(p) {
if int(size) <= r.Overhead() || int(size) > len(p) {
return 0, io.EOF
}

Expand All @@ -111,8 +111,6 @@ func (r *aeadReader) read(p []byte) (int, error) {

func (r *aeadReader) Read(p []byte) (int, error) {
if r.buf == nil {
// https://www.v2fly.org/en_US/developer/protocols/vmess.html#standard-format
// According to the spec, the maximum data length is 2^14 (chunkSize)
if len(p) >= chunkSize {
return r.read(p)
}
Expand Down

0 comments on commit 40f75ef

Please sign in to comment.