From: Ludovic R. <lud...@gm...> - 2013-05-28 07:20:01
|
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 The idea is that the PIN_VERIFY_STRUCTURE is just the _header_ in a larger structure. You have to allocate a big enough structure to store the PIN_VERIFY_STRUCTURE header _and_ the complete APDU. > 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. Bye -- Dr. Ludovic Rousseau |