Skip to content

Commit

Permalink
Fixed potential array out of bounds exception, and an issue where we …
Browse files Browse the repository at this point in the history
…would not read the entire server response
  • Loading branch information
drogin committed Aug 9, 2019
1 parent 4ff23d3 commit 0ba6abe
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 0ba6abe

Please sign in to comment.