Skip to content

Commit

Permalink
Merge pull request #154 from Devolutions/wayk-2430
Browse files Browse the repository at this point in the history
Wayk 2430: Avoid infinite loop if no data is received for RDP connection
  • Loading branch information
fdubois1 authored Apr 13, 2021
2 parents 66aa58c + 078783f commit b7dc2a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This document provides a list of notable changes introduced in Devolutions Gateway by release.

## 2021.1.3 (2021-04-13)
* Fix infinite loop issue when the precondition pdu was not completely received

## 2021.1.2 (2021-03-26)
* Fix broken Linux container image (missing executable)
* Add PowerShell module .zip/.nupkg to release artifacts
Expand Down
8 changes: 8 additions & 0 deletions devolutions-gateway/src/rdp/accept_connection_future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ impl AcceptConnectionFuture {
ready!(pinned_client.poll_read(cx, &mut read_buf))?;

let read_bytes = read_buf.filled().len();

if read_bytes == 0 {
return Poll::Ready(Err(io::Error::new(
io::ErrorKind::UnexpectedEof,
"No data to read, EOF has been reached.",
)));
}

self.buffer.extend_from_slice(&received[..read_bytes]);

if self.buffer.len() > MAX_FUTURE_BUFFER_SIZE {
Expand Down

0 comments on commit b7dc2a9

Please sign in to comment.