mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-08 17:24:08 +00:00
Merge pull request from GHSA-x462-89pf-6r5h
This commit is contained in:
parent
04623718ce
commit
8e38ecdeb2
@ -4,6 +4,7 @@ package protocol
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -86,6 +87,9 @@ func ReadMessage(r io.Reader) (interface{}, error) {
|
|||||||
if header.magic != magic {
|
if header.magic != magic {
|
||||||
return nil, errors.New("magic mismatch")
|
return nil, errors.New("magic mismatch")
|
||||||
}
|
}
|
||||||
|
if header.messageLength < 0 || header.messageLength > 1024 {
|
||||||
|
return nil, fmt.Errorf("bad length (%d)", header.messageLength)
|
||||||
|
}
|
||||||
|
|
||||||
buf = make([]byte, int(header.messageLength))
|
buf = make([]byte, int(header.messageLength))
|
||||||
if _, err := io.ReadFull(r, buf); err != nil {
|
if _, err := io.ReadFull(r, buf); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user