[Pcsclite-muscle] pcsc_stringify_error thread safety

Nikos Mavrogiannopoulos nmav
Wed Jan 18 02:29:21 PST 2017


On Tue, 2017-01-17 at 20:33 +0100, Maksim Ivanov wrote:

> The pcsc_stringify_error function in the PC/SC-Lite implementation
> uses a statically allocated buffer. This means that the buffer may be
> used simultaneously when the function is called from multiple threads
> concurrently.
> Therefore, the returned message may be spoiled, e.g.:
> "Internal error.ul"
> or
> "Command cancell"
> In the worst-case scenario, the application may read an unbounded
> string (with the terminating null character missing).

A possible fix is attached. That avoids copying strings which are?
constant on global store, and ensures that the static buffer is on
thread local store when possible.

Except compilation, the fix is completely untested.

regards,
Nikos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-pcsc_stringify_error-address-overlapping-static-vari.patch
Type: text/x-patch
Size: 3737 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pcsclite-muscle/attachments/20170118/d79813f3/attachment.bin>



More information about the pcsclite-muscle mailing list