Skip to content

Commit

Permalink
Error if stream reader receives 0 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
cpdt committed Aug 4, 2022
1 parent 0daa524 commit a1e9254
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions northstar-rcon-client/src/inner_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ impl InnerClientRead {

let write_len = self.read.read(&mut self.buffer[write_start..]).await?;

if write_len == 0 {
return Err(std::io::Error::from(std::io::ErrorKind::UnexpectedEof).into());
}

// Shrink the buffer again so it only contains written data
self.buffer.truncate(write_start + write_len);
}
Expand Down

0 comments on commit a1e9254

Please sign in to comment.