Merge pull request #6826 from akallabeth/smart_trace_error

Fixed smartcard crash on error return (invalid length)
This commit is contained in:
David Fort 2021-02-18 21:34:16 +01:00 committed by GitHub
commit 77d29388de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1275,13 +1275,18 @@ static void smartcard_trace_status_return(SMARTCARD_DEVICE* smartcard, const Sta
{
char* mszReaderNamesA = NULL;
char buffer[1024];
DWORD cBytes;
WINPR_UNUSED(smartcard);
if (!WLog_IsLevelActive(WLog_Get(TAG), g_LogLevel))
return;
mszReaderNamesA = smartcard_convert_string_list(ret->mszReaderNames, ret->cBytes, unicode);
cBytes = ret->cBytes;
if (ret->ReturnCode != SCARD_S_SUCCESS)
cBytes = 0;
if (cBytes == SCARD_AUTOALLOCATE)
cBytes = 0;
mszReaderNamesA = smartcard_convert_string_list(ret->mszReaderNames, cBytes, unicode);
WLog_LVL(TAG, g_LogLevel, "Status%s_Return {", unicode ? "W" : "A");
WLog_LVL(TAG, g_LogLevel, " ReturnCode: %s (0x%08" PRIX32 ")",