Hello,

yesterday I had two segfaults of pcscd 1.6.7 (which I can't reproduce)
The only thing which looks suspicious is a valgrind warning.
(for 1.6.7 / 1.7.0)

"Syscall param socketcall.send(msg) points to uninitialised byte(s)"

Attached the sample program.
The valgrind warning happens with 1.7.0 too.
But I'm unsure if this is related to the segfault.

regards,

Martin
#include <PCSC/winscard.h>
#include <PCSC/pcsclite.h>
#include <PCSC/reader.h> // for SCARD_CTL_CODE

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

/**
  compile with:

  gcc -L /usr/local/lib/ -I /usr/local/include/PCSC/ scontrol.c -lpcsclite

  run:
   valgrind ./a.out

   Syscall param socketcall.send(msg) points to uninitialised byte(s)
   at 0x4113E51: send (socket.S:64)
   by 0x4040E7C: MessageSendWithHeader (winscard_msg.c:294)
   by 0x403CC36: SCardControl (winscard_clnt.c:2377)



 */

int main() {
	uint32_t ret;
	SCARDCONTEXT hContext;
	char* mszReaders;
	DWORD pcchReaders=SCARD_AUTOALLOCATE;
	SCARDHANDLE hCard;
	DWORD dwActiveProtocol;
	DWORD dwControlCode;
	char* pbRecvBuffer;
	int cbRecvLength=1024;
	DWORD lpBytesReturned;
	ret=SCardEstablishContext(SCARD_SCOPE_SYSTEM,NULL,NULL,&hContext);
	printf("%s\n",pcsc_stringify_error(ret));
	ret=SCardListReaders(hContext, NULL,
			     (char*)&mszReaders, &pcchReaders);
	printf("%s\n",pcsc_stringify_error(ret));
	ret=SCardConnect(hContext,mszReaders,SCARD_SHARE_SHARED,
			 SCARD_PROTOCOL_T0|SCARD_PROTOCOL_T1,
			 &hCard,&dwActiveProtocol);
	printf("%s\n",pcsc_stringify_error(ret));
	dwControlCode=SCARD_CTL_CODE(3400);
	pbRecvBuffer=malloc(cbRecvLength);
	ret=SCardControl(hCard,dwControlCode,NULL,0,
			 pbRecvBuffer,cbRecvLength,&lpBytesReturned);
	printf("%s\n",pcsc_stringify_error(ret));
	return 0;
}
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to