From c92d2e35986730d859f36015169b98127fefba60 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Tue, 10 Oct 2017 22:29:38 -0400 Subject: [PATCH] GUACAMOLE-362: Loop through reading bytes from key file. --- .../properties/PrivateKeyGuacamoleProperty.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/properties/PrivateKeyGuacamoleProperty.java b/guacamole-ext/src/main/java/org/apache/guacamole/properties/PrivateKeyGuacamoleProperty.java index c360f4b9e..68070f5e7 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/properties/PrivateKeyGuacamoleProperty.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/properties/PrivateKeyGuacamoleProperty.java @@ -55,18 +55,19 @@ public abstract class PrivateKeyGuacamoleProperty implements GuacamoleProperty

= 0; + keyRead = keyInput.read(keyBytes, totalBytesRead, (keyBytes.length - totalBytesRead))) { + totalBytesRead += keyRead; + } // Zero-sized key - else if(keyRead == 0) + if (totalBytesRead == 0) throw new GuacamoleServerException("Failed to ready key because key is empty."); // Fewer bytes read than contained in the key - else if (keyRead < keyLength) + else if (totalBytesRead < keyLength) throw new GuacamoleServerException("Unable to read the full length of the key."); keyInput.close();