[Pcsclite-muscle] Valgrind error in SCardEstablishContext(): socketcall.connect points to uninitialized bytes
Mon Jul 31 01:03:27 PDT 2017
2017-07-19 15:14 GMT+02:00 Thomas Bajer <thomas.bajer at physec.de>:
> I would like to report an error message which valgrind throws the first
> time "SCardEstablishContext()" is called. The error message does not
> appear again when a second call to the function is done.
> Please have a look at the attached minimal example code. The program
> connects and disconnects to a smartcard two times. In order for the
> valgrind message to trigger, a smartcard has to be connected to the PC
> and the pcscd service has to be running.
> The code was linked with the newest stable release, 1.8.22.
> The code is compiled and linked on a FreeBSD system running FreeBSD 10.3
> (AMD64), the executable is then copied to a pfsense Box which also runs
> FreeBSD 10.3 with the same pcscd version.
> It would be great if a developer could look at this and commit a fix for
> this message.
> Below is the exampleConnect.c example, the build command and the
> valgrind error log.
I can't reproduce your problem with a Debian stable system on amd64.
$ valgrind --leak-check=full ./sample
==4086== Memcheck, a memory error detector
==4086== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==4086== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright
==4086== Command: ./sample
Connect to card
Connect to card
==4086== HEAP SUMMARY:
==4086== in use at exit: 112 bytes in 4 blocks
==4086== total heap usage: 21 allocs, 17 frees, 1,922 bytes allocated
==4086== LEAK SUMMARY:
==4086== definitely lost: 0 bytes in 0 blocks
==4086== indirectly lost: 0 bytes in 0 blocks
==4086== possibly lost: 0 bytes in 0 blocks
==4086== still reachable: 112 bytes in 4 blocks
==4086== suppressed: 0 bytes in 0 blocks
==4086== Reachable blocks (those to which a pointer was found) are not
==4086== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==4086== For counts of detected and suppressed errors, rerun with: -v
==4086== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Please rebuild pcsc-lite using this patch and try again:
--- /tmp/lJqSB4_winscard_msg.c 2017-07-31 10:02:24.804416987 +0200
+++ src/winscard_msg.c 2017-07-31 09:59:09.565876305 +0200
@@ -130,6 +130,7 @@ INTERNAL int ClientSetupSession(uint32_t
*pdwClientID = ret;
socketName = getSocketName();
+ memset(&svc_addr, 0, sizeof svc_addr);
svc_addr.sun_family = AF_UNIX;
strncpy(svc_addr.sun_path, socketName, sizeof(svc_addr.sun_path));
Dr. Ludovic Rousseau
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pcsclite-muscle