Skip to content

Commit

Permalink
Merge pull request #109 from lixin9311/aead_packet_decryption_overlap…
Browse files Browse the repository at this point in the history
…_fix

Fix the overlap problem of udp decryption.
  • Loading branch information
lixin9311 authored Aug 29, 2018
2 parents 18fc4a9 + 89e875b commit 8f3c47f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions shadowaead/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ func (c *packetConn) ReadFrom(b []byte) (int, net.Addr, error) {
if err != nil {
return n, addr, err
}
b, err = Unpack(b, b[:n], c)
return len(b), addr, err
bb, err := Unpack(b[c.Cipher.SaltSize():], b[:n], c)
if err != nil {
return n, addr, err
}
copy(b, bb)
return len(bb), addr, err
}
2 changes: 1 addition & 1 deletion shadowstream/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ func (c *packetConn) ReadFrom(b []byte) (int, net.Addr, error) {
return n, addr, err
}
copy(b, bb)
return len(b), addr, err
return len(bb), addr, err
}

0 comments on commit 8f3c47f

Please sign in to comment.