Baekalfen / ICAP-avscan

Uploads a file to a ICAP server.
MIT License
47 stars 29 forks source link

having issue while scanning file greater than 2 mb #7

Closed at199 closed 7 years ago

at199 commented 7 years ago
while((offset < STD_RECIEVE_LENGTH) && ((n = in.read(buffer, offset, 1)) != -1)) { // first part is to secure against DOS
            offset += n;
            //log.info("inside while");
            if (offset>endofheader.length+13){ // 13 is the smallest possible message "ICAP/1.0 XXX "
                //log.info("offset  "+offset);
                byte[] lastBytes = Arrays.copyOfRange(buffer, offset-endofheader.length, offset);
                log.info("lastBytes"+lastBytes.length);
                if (Arrays.equals(endofheader,lastBytes)){
                    return new String(buffer,0,offset, StandardCharsetsUTF8);
                }
            }
        }
        throw new ICAPException("Error in getHeader() method");

if condition not stisfied here i am getting last byte length 5 and it comes to exception block

at199 commented 7 years ago

small update this issue is only for image upload

Baekalfen commented 7 years ago

What server are you running against? And are you able to dump the whole communication in Wireshark (or the likes) and post it here?

at199 commented 7 years ago

actually all setup i got from client and don't have access . i use the above(your) code on dam update .every thing working fine except uploading of image more than 2 mb, offset going to max standerd size ie 8192. Is there any configuration that blocking then i can ask to client,

Baekalfen commented 7 years ago

My code doesn't intentionally differentiate between filetypes. You'll have to provide some more information on the problem, otherwise it's going to be impossible to locate a bug.

at199 commented 7 years ago

yes you re right, it may be a configuration issue, i need to check will let you know when getting any if form infra team

at199 commented 7 years ago

info

at199 commented 7 years ago

i am sorry for the trouble, this was a configuration issue.