Hi,

On Friday, January 4, 2002, at 03:44  pm, hariharan swaminathan wrote:

> Hi,
> If i remember correct , dwRecvLength should be set by SCardTransmit.
> We are passing a pointer  to get the result length. So i don't 
> understand why this has to be set.

I think it should be set by the caller as the maximum length of the 
response (i.e. the size of the buffer). Otherwise SCardTransmit does not 
know how much information it can return.

Not checking this length might cause a buffer overflow...

So I would patch the code with:

                                  dwRecvLength =  sizeof(r); // size of response buffer
                                rv = SCardTransmit( hCard, PROTOCOL, buffer,
dwSendLength, \
              &sRecvPci, r, &dwRecvLength ); \

BTW, 256 is too small as the answer could be 256 bytes of Data + 2 bytes 
for the SW.

Cheers,
JLuc.

***************************************************************
Unix Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/
To unsubscribe send an email to [EMAIL PROTECTED] with
unsubscribe sclinux
***************************************************************

Reply via email to