Hello,

I just released pcsc-lite version 1.5.1. It is available at [1].

Changelog:
pcsc-lite-1.5.1: Ludovic Rousseau
7 January 2009
- Extended APDU of more than 2048 bytes were corrupted. The problem was
  introduced in version 1.3.3 (2 years ago) by making the code compile
  with Sun Studio 11.
  Thanks to Eric Mounier for the patch
- some other minor improvements and bug corrections


The changelog is very short but the bug is annoying, even if it is
present since 2 years and not so many users complained (2 people).
Here is the history of the bug.
- Version 1.3.2 (August 2006) added support of extended APDU in the
standard configuration. I used a nice hack in struct
transmit_struct_extended (file src/winscard_msg.h) by using a "char
data[0]" field at the end of the structure. The array size is 0 so the
label is defined but memory used by the field is 0 bytes. I used this
to reference the byte just after the structure (data[] not included).
- In [2] Iain MacDonnell complained that the Sun Studio 11 does not
like a zero size array.
- I then changed the 0 into 1 in release 1.3.3 (January 2007) and the
Sun compiler was happy
- The problem is that sizeof(transmit_struct_extended) is no more the
size of just the header. It now also include 1 byte of data[]. And
because of memory alignement the sizeof() is 4 bytes bigger than
needed.
- The problem went unnoticed. It is also my fault since my unitary
tests test for 272, 528, 784 and 1040 extended APDU sizes. But never
more than 2048 bytes. 2048 is the size of unsigned char
data[PCSCLITE_MAX_MESSAGE_SIZE] in struct rxSharedSegment
- In December 2008 I received a mail about a problem with extended
APDU but without a clear test case or explanation. The bug was on my
todo list but with a low priority.
- In January 2009 Eric Mounier opened a bug [3] with a description of
the problem and the solution: replace the use of sizeof() by the use
of offsetof() to know the offset of the data[] field and then the size
of just the header without the data[] field.

Thanks again to Eric for tracking the bug and proposing a solution.

Regards and happy new year 2009,

[1] https://alioth.debian.org/frs/?group_id=30105&release_id=1273
[2] http://archives.neohapsis.com/archives/dev/muscle/2006-q3/0181.html
[3] 
https://alioth.debian.org/tracker/index.php?func=detail&aid=311339&group_id=30105&atid=410085

-- 
 Dr. Ludovic Rousseau
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to