mirror of https://github.com/FreeRDP/FreeRDP
channels/smartcard: fix pioRecvPci with cbExtraBytes > 0
This commit is contained in:
parent
1222da4a86
commit
cb002d91cd
|
@ -146,7 +146,10 @@ UINT32 smartcard_pack_write_size_align(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||||
pad = size - pad;
|
pad = size - pad;
|
||||||
|
|
||||||
if (pad)
|
if (pad)
|
||||||
|
{
|
||||||
|
Stream_EnsureRemainingCapacity(s, pad);
|
||||||
Stream_Zero(s, pad);
|
Stream_Zero(s, pad);
|
||||||
|
}
|
||||||
|
|
||||||
return pad;
|
return pad;
|
||||||
}
|
}
|
||||||
|
@ -2423,9 +2426,11 @@ UINT32 smartcard_pack_transmit_return(SMARTCARD_DEVICE* smartcard, wStream* s, T
|
||||||
Stream_Write_UINT32(s, pbExtraBytesNdrPtr); /* pbExtraBytesNdrPtr (4 bytes) */
|
Stream_Write_UINT32(s, pbExtraBytesNdrPtr); /* pbExtraBytesNdrPtr (4 bytes) */
|
||||||
|
|
||||||
if (pbExtraBytesNdrPtr)
|
if (pbExtraBytesNdrPtr)
|
||||||
|
{
|
||||||
|
Stream_Write_UINT32(s, cbExtraBytes); /* Length (4 bytes) */
|
||||||
Stream_Write(s, pbExtraBytes, cbExtraBytes);
|
Stream_Write(s, pbExtraBytes, cbExtraBytes);
|
||||||
|
smartcard_pack_write_size_align(smartcard, s, cbExtraBytes, 4);
|
||||||
smartcard_pack_write_size_align(smartcard, s, cbExtraBytes, 4);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pbRecvBufferNdrPtr)
|
if (pbRecvBufferNdrPtr)
|
||||||
|
|
|
@ -2178,7 +2178,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardTransmit(SCARDHANDLE hCard,
|
||||||
}
|
}
|
||||||
|
|
||||||
status = (LONG) g_PCSC.pfnSCardTransmit(hCard, pcsc_pioSendPci, pbSendBuffer,
|
status = (LONG) g_PCSC.pfnSCardTransmit(hCard, pcsc_pioSendPci, pbSendBuffer,
|
||||||
pcsc_cbSendLength, pcsc_pioRecvPci, pbRecvBuffer, &pcsc_cbRecvLength);
|
pcsc_cbSendLength, pcsc_pioRecvPci, pbRecvBuffer, &pcsc_cbRecvLength);
|
||||||
status = PCSC_MapErrorCodeToWinSCard(status);
|
status = PCSC_MapErrorCodeToWinSCard(status);
|
||||||
*pcbRecvLength = (DWORD) pcsc_cbRecvLength;
|
*pcbRecvLength = (DWORD) pcsc_cbRecvLength;
|
||||||
|
|
||||||
|
@ -2186,7 +2186,13 @@ WINSCARDAPI LONG WINAPI PCSC_SCardTransmit(SCARDHANDLE hCard,
|
||||||
free(pcsc_pioSendPci); /* pcsc_pioSendPci is dynamically allocated only when pioSendPci is non null */
|
free(pcsc_pioSendPci); /* pcsc_pioSendPci is dynamically allocated only when pioSendPci is non null */
|
||||||
|
|
||||||
if (pioRecvPci)
|
if (pioRecvPci)
|
||||||
|
{
|
||||||
|
cbExtraBytes = pioRecvPci->cbPciLength - sizeof(SCARD_IO_REQUEST);
|
||||||
|
pbExtraBytes = &((BYTE*) pioRecvPci)[sizeof(SCARD_IO_REQUEST)];
|
||||||
|
pcsc_pbExtraBytes = &((BYTE*) pcsc_pioRecvPci)[sizeof(PCSC_SCARD_IO_REQUEST)];
|
||||||
|
CopyMemory(pbExtraBytes, pcsc_pbExtraBytes, cbExtraBytes); /* copy extra bytes */
|
||||||
free(pcsc_pioRecvPci); /* pcsc_pioRecvPci is dynamically allocated only when pioRecvPci is non null */
|
free(pcsc_pioRecvPci); /* pcsc_pioRecvPci is dynamically allocated only when pioRecvPci is non null */
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue