mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-12-22 23:57:26 +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 {
|
if vc.readFilterUUID {
|
||||||
headerUUIDLen = uuid.Size
|
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)
|
_, err := io.ReadFull(vc.ExtendedReader, header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user