Skip to content

Commit

Permalink
Merge pull request #1 from drogin/master
Browse files Browse the repository at this point in the history
Fixed potential array out of bounds exception, issue solita#14 solita#16
  • Loading branch information
vicmosin authored Mar 26, 2020
2 parents 4ff23d3 + 0ba6abe commit 5a3f97c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/fi/solita/clamav/ClamAVClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,9 @@ private static byte[] readAll(InputStream is) throws IOException {

byte[] buf = new byte[2000];
int read = 0;
do {
read = is.read(buf);
tmp.write(buf, 0, read);
} while ((read > 0) && (is.available() > 0));
while ((read = is.read(buf)) != -1) {
tmp.write(buf, 0, read);
}
return tmp.toByteArray();
}
}

0 comments on commit 5a3f97c

Please sign in to comment.