greyp9 commented on a change in pull request #5420:
URL: https://github.com/apache/nifi/pull/5420#discussion_r718567092
##########
File path:
nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/map/MapCacheServer.java
##########
@@ -251,10 +251,17 @@ protected void finalize() throws Throwable {
}
private byte[] readValue(final DataInputStream dis) throws IOException {
- final int numBytes = dis.readInt();
+ final int numBytes = validateInt(dis.readInt(), getMaxReadSize(),
"readValue():");
final byte[] buffer = new byte[numBytes];
dis.readFully(buffer);
return buffer;
}
+ private int validateInt(final int value, final int max, final String
identifier) throws IOException {
+ if (value <= max) {
+ return value;
+ } else {
+ throw new IOException(new IllegalArgumentException(identifier +
value));
+ }
+ }
Review comment:
I was thinking the same thing :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]