mirror of
https://github.com/cbeuw/Cloak.git
synced 2024-11-17 15:25:30 +00:00
Fix a potential make len<0
This commit is contained in:
parent
b7549c0664
commit
e3de2b9852
@ -89,7 +89,11 @@ func MakeDeobfs(salsaKey [32]byte, payloadCipher cipher.AEAD) Deobfser {
|
|||||||
closing := header[8]
|
closing := header[8]
|
||||||
extraLen := header[9]
|
extraLen := header[9]
|
||||||
|
|
||||||
outputPayload := make([]byte, len(payload)-int(extraLen))
|
outputLen := len(payload) - int(extraLen)
|
||||||
|
if outputLen < 0 {
|
||||||
|
return nil, errors.New("extra length is greater than total payload length")
|
||||||
|
}
|
||||||
|
outputPayload := make([]byte, outputLen)
|
||||||
|
|
||||||
if payloadCipher == nil {
|
if payloadCipher == nil {
|
||||||
copy(outputPayload, payload)
|
copy(outputPayload, payload)
|
||||||
|
Loading…
Reference in New Issue
Block a user