mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-06 05:17:38 +03:00
Fix buffer overflow
This commit is contained in:
parent
4e70523360
commit
b2828dac5f
4 changed files with 5 additions and 11 deletions
|
@ -199,7 +199,7 @@ func (b *Buffer) ReadAtLeastFrom(r io.Reader, min int) (int64, error) {
|
|||
}
|
||||
|
||||
func (b *Buffer) ReadFullFrom(r io.Reader, size int) (n int, err error) {
|
||||
if b.IsFull() {
|
||||
if b.end+size > b.Cap() {
|
||||
return 0, io.ErrShortBuffer
|
||||
}
|
||||
n, err = io.ReadFull(r, b.data[b.end:b.end+size])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue