Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong bytes send as file data #23

Open
mikolajkubi opened this issue Jun 16, 2020 · 2 comments
Open

wrong bytes send as file data #23

mikolajkubi opened this issue Jun 16, 2020 · 2 comments

Comments

@mikolajkubi
Copy link

In code of

while ((fileInStream.read(buffer)) != -1) {

we can see this lines:
while ((fileInStream.read(buffer)) != -1) {
sendString(Integer.toHexString(buffer.length) +"\r\n");
sendBytes(buffer);

But method InputStream.read() may not read full buffer. This method returns the total number of bytes read into the buffer, and this value should be used in next lines. For send string and as parameter for sendBytes() call.
In current state this method is sending additional bytes from buffer which were not filled by read() call.

@Baekalfen
Copy link
Owner

There might very well be some missing or faulty code. I haven't had access to any ICAP hardware in years, so I rely on others to make pull-requests with fixes.

@lowedown
Copy link

lowedown commented Sep 23, 2020

I ran into the same issue. By sending the entire buffer instead of only the remaining bytes our ICAP server didn't recognize the eicar.com testfile because it's hash was changed.
Created a PR for the C# client. Someone needs to test and update this for the Java client too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants