fix bug
This commit is contained in:
parent
bd2cf3865d
commit
a6bf1c0e7d
@ -20,7 +20,7 @@ type PackAppData struct {
|
||||
|
||||
func (m PackAppData) Read(p []byte) (n int, err error) {
|
||||
|
||||
buf := make([]byte, 32*1024+HeaderLength+2)
|
||||
buf := make([]byte, 48*1024+HeaderLength+2)
|
||||
|
||||
headRead, err := io.ReadAtLeast(m.Conn, buf[0:HeaderLength+2], HeaderLength+2)
|
||||
if err != nil {
|
||||
@ -44,14 +44,15 @@ func (m PackAppData) Read(p []byte) (n int, err error) {
|
||||
return 0, e
|
||||
}
|
||||
}
|
||||
copy(p[sum:], buf[HeaderLength+2+sum:HeaderLength+2+sum+r])
|
||||
sum += r
|
||||
}
|
||||
if len(EncryptKey) > 0 {
|
||||
encryptedData := p[0:sum]
|
||||
encryptedData := buf[HeaderLength+2 : HeaderLength+2+sum]
|
||||
decrypted := AesDecryptCBC(encryptedData, EncryptKey)
|
||||
copy(p[0:], decrypted)
|
||||
sum = len(decrypted)
|
||||
} else {
|
||||
copy(p[0:], buf[HeaderLength+2:HeaderLength+2+sum])
|
||||
}
|
||||
return sum, err
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user