mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-15 19:22:53 +08:00
Fix short buffer
This commit is contained in:
parent
9aacfe11e7
commit
c5444a03ac
|
@ -104,7 +104,12 @@ func (vc *Conn) ReadBuffer(buffer *buf.Buffer) error {
|
|||
if vc.readFilterUUID {
|
||||
headerUUIDLen = uuid.Size
|
||||
}
|
||||
header := buffer.FreeBytes()[:paddingHeaderLen+headerUUIDLen]
|
||||
var header []byte
|
||||
if need := headerUUIDLen + paddingHeaderLen; buffer.FreeLen() < need {
|
||||
header = make([]byte, need)
|
||||
} else {
|
||||
header = buffer.FreeBytes()[:need]
|
||||
}
|
||||
_, err := io.ReadFull(vc.ExtendedReader, header)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue
Block a user