Fix: Verify number of bytes contained in sessiond agent commands
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Thu, 19 May 2016 18:54:59 +0000 (14:54 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 19 May 2016 19:52:20 +0000 (15:52 -0400)
The command header indicates the number of bytes in the payload.
Make sure those bytes were really present on the socket, and throw
an error if they were not.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java

index 333dd5b02a7234256d1908499f0f6615a7c4a390..37f4ec4e59289c0f146d1766573af02e97254492 100644 (file)
@@ -374,7 +374,10 @@ public class LttngTcpSessiondClient implements Runnable {
                        return null;
                }
 
-               this.inFromSessiond.read(payload, 0, payload.length);
+               int read = inFromSessiond.read(payload, 0, payload.length);
+               if (read != payload.length) {
+                       throw new IOException("Unexpected number of bytes read in sessiond command payload");
+               }
                return payload;
        }
 
This page took 0.025547 seconds and 4 git commands to generate.