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();