diff options
-rw-r--r-- | dozentenmodulserver/pom.xml | 6 | ||||
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/JsonHttpListener.java | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/dozentenmodulserver/pom.xml b/dozentenmodulserver/pom.xml index 3493feb8..26666ac5 100644 --- a/dozentenmodulserver/pom.xml +++ b/dozentenmodulserver/pom.xml @@ -140,9 +140,9 @@ <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> - <source>11</source> - <target>11</target> - <release>11</release> + <source>1.8</source> + <target>1.8</target> + <release>8</release> <compilerArgument>-Xlint:all</compilerArgument> </configuration> </plugin> diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/JsonHttpListener.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/JsonHttpListener.java index 55c09756..cec5dd5f 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/JsonHttpListener.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/JsonHttpListener.java @@ -57,7 +57,15 @@ public class JsonHttpListener extends NanoHTTPD { return new Response(Response.Status.BAD_REQUEST, "text/plain; charset=UTF-8", "No Content-Length provided"); - byte[] buffer = session.getInputStream().readNBytes(len); + byte[] buffer = new byte[len]; + int pos = 0; + while (pos < len) { + int ret = session.getInputStream().read(buffer, pos, len - pos); + if (ret <= 0) + return new Response(Response.Status.BAD_REQUEST, "text/plain; charset=UTF-8", + "Request content truncated (" + pos + "/" + len + ")"); + pos += ret; + } TMemoryBuffer inbuffer = new TMemoryBuffer(buffer.length); inbuffer.write(buffer); TProtocol inprotocol = new TJSONProtocol(inbuffer); |