Merge pull request #1484 from matt335672/cppc-chansrv-pcsc

xrdp_pcsc: Fix cppcheck 1.82 + 1.90 warnings
This commit is contained in:
metalefty 2020-01-30 10:28:36 +09:00 committed by GitHub
commit 6d7cce3d34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1064,10 +1064,11 @@ SCardTransmit(SCARDHANDLE hCard, const SCARD_IO_REQUEST *pioSendPci,
offset += 4; offset += 4;
memcpy(msg + offset, pbSendBuffer, cbSendLength); memcpy(msg + offset, pbSendBuffer, cbSendLength);
offset += cbSendLength; offset += cbSendLength;
got_recv_pci = (pioRecvPci != NULL) && (pioRecvPci->cbPciLength >= 8);
// TODO figure out why recv pci does not work // TODO figure out why recv pci does not work
if (1 || (pioRecvPci == 0) || (pioRecvPci->cbPciLength < 8)) got_recv_pci = 0;
if (got_recv_pci == 0)
{ {
got_recv_pci = 0;
SET_UINT32(msg, offset, 0); /* dwProtocol */ SET_UINT32(msg, offset, 0); /* dwProtocol */
offset += 4; offset += 4;
SET_UINT32(msg, offset, 0); /* cbPciLength */ SET_UINT32(msg, offset, 0); /* cbPciLength */
@ -1077,7 +1078,6 @@ SCardTransmit(SCARDHANDLE hCard, const SCARD_IO_REQUEST *pioSendPci,
} }
else else
{ {
got_recv_pci = 1;
SET_UINT32(msg, offset, pioRecvPci->dwProtocol); SET_UINT32(msg, offset, pioRecvPci->dwProtocol);
offset += 4; offset += 4;
SET_UINT32(msg, offset, pioRecvPci->cbPciLength); SET_UINT32(msg, offset, pioRecvPci->cbPciLength);
@ -1167,7 +1167,6 @@ SCardListReaders(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders,
int status; int status;
int offset; int offset;
int index; int index;
int bytes_groups;
int val; int val;
int llen; int llen;
char reader[100]; char reader[100];
@ -1188,15 +1187,19 @@ SCardListReaders(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders,
offset = 0; offset = 0;
SET_UINT32(msg, offset, hContext); SET_UINT32(msg, offset, hContext);
offset += 4; offset += 4;
bytes_groups = 0;
if (mszGroups != 0) if (mszGroups != 0)
{ {
bytes_groups = strlen(mszGroups); unsigned int bytes_groups = strlen(mszGroups);
SET_UINT32(msg, offset, bytes_groups);
offset += 4;
memcpy(msg + offset, mszGroups, bytes_groups);
offset += bytes_groups;
}
else
{
SET_UINT32(msg, offset, 0);
offset += 4;
} }
SET_UINT32(msg, offset, bytes_groups);
offset += 4;
memcpy(msg + offset, mszGroups, bytes_groups);
offset += bytes_groups;
val = *pcchReaders; val = *pcchReaders;
SET_UINT32(msg, offset, val); SET_UINT32(msg, offset, val);
offset += 4; offset += 4;