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>
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;
}