mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
Crash for explainable reason when protocol is out of sync (version skew)
This commit is contained in:
parent
8589a0fb40
commit
e86296884a
2
main.go
2
main.go
@ -153,7 +153,7 @@ func main() {
|
|||||||
// Walk the repository and update the local model before establishing any
|
// Walk the repository and update the local model before establishing any
|
||||||
// connections to other nodes.
|
// connections to other nodes.
|
||||||
|
|
||||||
infoln("Iniial repository scan in progress")
|
infoln("Initial repository scan in progress")
|
||||||
loadIndex(m)
|
loadIndex(m)
|
||||||
updateLocalModel(m)
|
updateLocalModel(m)
|
||||||
|
|
||||||
|
@ -91,6 +91,11 @@ func (r *marshalReader) readBytes() []byte {
|
|||||||
if r.err != nil {
|
if r.err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if l > 10*1<<20 {
|
||||||
|
// Individual blobs in BEP are not significantly larger than BlockSize.
|
||||||
|
// BlockSize is not larger than 1MB.
|
||||||
|
panic("too large read - protocol error or out of sync")
|
||||||
|
}
|
||||||
b := buffers.Get(l + pad(l))
|
b := buffers.Get(l + pad(l))
|
||||||
_, r.err = io.ReadFull(r.r, b)
|
_, r.err = io.ReadFull(r.r, b)
|
||||||
r.tot += int(l + pad(l))
|
r.tot += int(l + pad(l))
|
||||||
|
Loading…
Reference in New Issue
Block a user