2010/5/29 Martin Vogt <[email protected]>:
> Hello,
>
> If logging support is compiled in, the daemon segfaults in the lookup of:
>
> CommandsText[header.command]
>
> The attached patch verifies if the received data actually is a valid
> command.
You need to use a patched libpcsclite to trigger this bug, right?
I do not understand your comment:
+ /** this marks the last command in the enum above. It cannt be part
+ of the enum itsself because the the protocal/CMDs
+ cannot be extended. */
+ #define CMD_ENUM_LAST CMD_STOP_WAITING_READER_STATE_CHANGE
I propose the attached patch instead.
Are you OK with it.
Thanks
--
Dr. Ludovic Rousseau
Index: winscard_msg.h
===================================================================
--- winscard_msg.h (revision 4965)
+++ winscard_msg.h (working copy)
@@ -56,6 +56,7 @@
*/
enum pcsc_msg_commands
{
+ CMD_ENUM_FIRST,
SCARD_ESTABLISH_CONTEXT = 0x01, /**< used by
SCardEstablishContext() */
SCARD_RELEASE_CONTEXT = 0x02, /**< used by
SCardReleaseContext() */
SCARD_LIST_READERS = 0x03, /**< used by
SCardListReaders() */
@@ -75,9 +76,11 @@
CMD_VERSION = 0x11, /**< get the
client/server protocol version */
CMD_GET_READERS_STATE = 0x12, /**< get the readers state */
CMD_WAIT_READER_STATE_CHANGE = 0x13, /**< wait for a reader
state change */
- CMD_STOP_WAITING_READER_STATE_CHANGE = 0x14 /**< stop
waiting for a reader state change */
+ CMD_STOP_WAITING_READER_STATE_CHANGE = 0x14, /**< stop
waiting for a reader state change */
+ CMD_ENUM_LAST
};
+
struct client_struct
{
uint32_t hContext;
Index: winscard_svc.c
===================================================================
--- winscard_svc.c (revision 4965)
+++ winscard_svc.c (working copy)
@@ -303,8 +303,10 @@
goto exit;
}
- Log3(PCSC_LOG_DEBUG, "Received command: %s from client %d",
- CommandsText[header.command], filedes);
+ if ((header.command > CMD_ENUM_FIRST)
+ && (header.command < CMD_ENUM_LAST))
+ Log3(PCSC_LOG_DEBUG, "Received command: %s from client
%d",
+ CommandsText[header.command], filedes);
switch (header.command)
{
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle