From 61f5f96b4229a97152bfc05bc97682dd8316d071 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 30 May 2019 16:33:13 +0200 Subject: [PATCH] Fix control event String parsing At least 2 bytes must be available to read the length of the String. --- .../src/main/java/com/genymobile/scrcpy/ControlEventReader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/ControlEventReader.java b/server/src/main/java/com/genymobile/scrcpy/ControlEventReader.java index b316c34a..8eeea27c 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ControlEventReader.java +++ b/server/src/main/java/com/genymobile/scrcpy/ControlEventReader.java @@ -93,7 +93,7 @@ public class ControlEventReader { } private ControlEvent parseTextControlEvent() { - if (buffer.remaining() < 1) { + if (buffer.remaining() < 2) { return null; } int len = toUnsigned(buffer.getShort());