EtiennePerot/fuse-jna — pull request #16 by daizaku (2013-07-25 09:36:57+00:00)
Title: Incorrect mapping of bitfields in StructFuseFileInfo

Certain flags in StructFuseFileInfo were mapped as individual variables when they should have been mapped as bitfields.

This is a serious bug that results in:
1. Memory beyond the allocated fuse struct being accessed and modified, potentially leading to a buffer overflow exploit.
2. Making it difficult to utilize any of these flags
2. Making it impossible to created file-handle based file systems, as the fh variable comes after this variable.

The source in fuse_common.h is specified as follows:
> unsigned int direct_io : 1;
> unsigned int keep_cache : 1;
> unsigned int flush : 1;
> unsigned int nonseekable : 1;
> unsigned int flock_release : 1;
> unsigned int padding : 27;

This change will fix this issue by making these flags as bitfields. Unfortunately, there isn't a clean way to do this mapping in JNA, so bitmask operations are used on a 32bit integer to accomplish this.