[jcifs] SmbComWriteAndX writes corrupt offset to wire

eglass1 at comcast.net eglass1 at comcast.net
Thu Apr 15 13:26:37 GMT 2004


>    static void writeInt4( long val, byte[] dst, int dstIndex ) {
>        dst[dstIndex++] = (byte)(val);
>        dst[dstIndex++] = (byte)(val >> 8);
>        dst[dstIndex++] = (byte)(val >> 16);
>        dst[dstIndex++] = (byte)(val >> 32);
>    }

The last shift in writeInt4 should be 24, not 32.  It's also faster (although
probably negligibly for our purposes) to do:

    static void writeInt4( long val, byte[] dst, int dstIndex ) {
        dst[dstIndex] = (byte)(val);
        dst[++dstIndex] = (byte)(val >>= 8);
        dst[++dstIndex] = (byte)(val >>= 8);
        dst[++dstIndex] = (byte)(val >> 8);
    }


More information about the jcifs mailing list