1 parent 611d792 commit 53cd6e8Copy full SHA for 53cd6e8
1 file changed
sftp/src/sftpsource.rs
@@ -20,7 +20,8 @@ pub struct SftpSource<'de> {
20
21
impl<'de> SSHSource<'de> for SftpSource<'de> {
22
fn take(&mut self, len: usize) -> sunset::sshwire::WireResult<&'de [u8]> {
23
- if len + self.index > self.buffer.len() {
+ if len.checked_add(self.index).ok_or(WireError::RanOut)? > self.buffer.len()
24
+ {
25
return Err(WireError::RanOut);
26
}
27
let original_index = self.index;
0 commit comments