Issue #2672 Allow One extra null byte in RemoteRequestRouteWrapper.

Former-commit-id: 3d08979eee [formerly 7463bf7c3efbdf8eb184f24bfc9c6a12c57d5006]
Former-commit-id: 40bc9df420
This commit is contained in:
Ben Steffensmeier 2014-02-10 17:39:32 -06:00
parent 733c21051c
commit a0227d2c4e

View file

@ -67,7 +67,18 @@ public class RemoteRequestRouteWrapper {
Object obj = SerializationUtil.transformFromThrift(Object.class,
data);
int remaining = data.available();
if (remaining > 0) {
if (remaining == 1) {
int tail = data.read();
/*
* When http proxies are being used there is a single null
* character at the end of the message, no need to panic.
*/
if (tail != 0x00) {
throw new IllegalStateException(
"Unexpected byte remaining after deserialization: "
+ tail);
}
} else if (remaining > 0) {
throw new IllegalStateException(remaining
+ " unexpected bytes remaining after deserialization");
}