ZeroNetX / zeronet-rs

Rust Implementation of ZeroNet Protocol
https://zeronet.dev
Other
70 stars 8 forks source link

Error while downloading a site: "range end index 20 out of range for slice of length 16" #40

Closed zolagonano closed 1 year ago

zolagonano commented 1 year ago

Error is caused by calling drain method on resp_buf in discovery::tracker::udp::udp_announce when the vector's length is smaller than 20: https://github.com/ZeroNetX/zeronet-rs/blob/8ca5e5b72b6eee03faec04fca8fa8ce79950c28d/src/discovery/tracker/udp.rs#L127

Here's the error (I printed length to make sure it's that):

resp_buf length before calling drain: 110
resp_buf length before calling drain: 16
thread 'main' panicked at 'range end index 20 out of range for slice of length 16', /rustc/993deaa0bf8bab9dd3eadfd1fbeb093328e95afe/library/alloc/src/vec/mod.rs:1993:36