Re: [PATCH] fix racecondition between winscard server and clients
Ludovic Rousseau <[email protected]> Thu, 8 Dec 2016 14:59:47 +0100
| Newsgroups | gmane.comp.lib.muscle |
|---|---|
| Message-ID | <CAGstE8A-niN7OdOfB8qU=ODWJm6KENCsBEibhS5q-KOf1V-7EQ@mail.gmail.com> |
2016-12-07 15:05 GMT+01:00 Florian Kaiser <[email protected]>: > 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