From: Ludovic R. <lud...@gm...> - 2013-05-28 08:23:26
|
2013/5/28 Ludovic Rousseau <lud...@gm...>: > 2013/5/27 Frank Morgner <mo...@in...>: >> Hi! > > Hello, > >> Enabling compiler warnings, I just found a bug in OpenSC. An array is >> accessed out of bounds. The pull request is issued, but the same bug >> also exists in PCSC-Lite (Drivers/ccid/MacOSX/reader.h and >> PCSC/src/PCSC/reader.h). Ludovic, you might want to have a look: >> >> https://github.com/frankmorgner/OpenSC/commit/e74d33441e87826b3409446d2e7b5c917b2697c4 > > It is not a bug but a feature. > Ideally I would like to use abData[0] or abData[] but some compilers complain. > It is called "C99 flexible array member" > > Maybe I should use something like > https://github.com/LudovicRousseau/libusbx/commit/53134e90f2f8fc516cc9794d79e754703da9e894 Done in revision 6638 http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2013-May/006191.html >> And by the way, do you think it is usefull to add >> __attribute__((packed)) to the struct? Otherwise there might be some >> padding between the members... > > Good idea. I will have a look. I already use a packed structure using: /* Set structure elements aligment on bytes * http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html */ #if defined(__APPLE__) | defined(sun) #pragma pack(1) #else #pragma pack(push, 1) #endif Bye -- Dr. Ludovic Rousseau |