[Pcsclite-muscle] [PATCH] fix racecondition between winscard server and clients

Ludovic Rousseau ludovic.rousseau at gmail.com
Thu Dec 8 13:59:47 UTC 2016


2016-12-07 15:05 GMT+01:00 Florian Kaiser <florian_kaiser at genua.de>:
> Hi,
>
> sorry to bother you again, but there is a small error in your upstream patch.
>
>
> +                               if (waStr.rv != SCARD_F_INTERNAL_ERROR)
> +                                       WRITE_BODY(waStr)
>
> WRITE_BODY is a Macro around two function calls. After the preprocessor ran
> the code would look something like this (the parameters are wrong here):
>
> if (waStr.rv != SCARD_F_INTERNAL_ERROR)
> log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1,
> data2, data3);
> ret = MessageSend(&v, sizeof(v), filedes);
>
> Now the if-statement only affects the log_msg function call, so the curly
> brackets are required around this kind of macro...
>
> I have attached a patch, which secures this macro and prevents errors like
> this.

You are right. Stupid me.

I tested the fix with an instrumented code using { } and it worked.

Problem fixed in
https://github.com/LudovicRousseau/PCSC/commit/152a53e5151f4f81c572dfeae02d5e0ea8eebccf

Thanks again.

I will release a new version of pcsc-lite soon to make the fix available.

Bye

-- 
 Dr. Ludovic Rousseau



More information about the Pcsclite-muscle mailing list