Fixed format string in smartcard_trace_state_return
authorakallabeth <akallabeth@posteo.net>
Tue, 2 Mar 2021 06:50:17 +0000 (07:50 +0100)
committerakallabeth <akallabeth@users.noreply.github.com>
Tue, 2 Mar 2021 07:31:28 +0000 (08:31 +0100)
(cherry picked from commit ca96c4450707d39dbd5c94f2b1c4ae807789b012)

channels/smartcard/client/smartcard_pack.c

index f5987d4..ed0301b 100644 (file)
@@ -1307,21 +1307,24 @@ static void smartcard_trace_status_return(SMARTCARD_DEVICE* smartcard, const Sta
 static void smartcard_trace_state_return(SMARTCARD_DEVICE* smartcard, const State_Return* ret)
 {
        char buffer[1024];
-
+       char* state;
        WINPR_UNUSED(smartcard);
 
        if (!WLog_IsLevelActive(WLog_Get(TAG), g_LogLevel))
                return;
 
+       state = SCardGetReaderStateString(ret->dwState);
        WLog_LVL(TAG, g_LogLevel, "Reconnect_Return {");
        WLog_LVL(TAG, g_LogLevel, "  ReturnCode: %s (0x%08" PRIX32 ")",
                 SCardGetErrorString(ret->ReturnCode), ret->ReturnCode);
-       WLog_LVL(TAG, g_LogLevel, "  dwState:    %s (0x%08" PRIX32 ")", ret->dwState);
-       WLog_LVL(TAG, g_LogLevel, "  dwProtocol: %s (0x%08" PRIX32 ")", ret->dwProtocol);
-       WLog_LVL(TAG, g_LogLevel, "  cbAtrLen:   %s (0x%08" PRIX32 ")", ret->cbAtrLen);
+       WLog_LVL(TAG, g_LogLevel, "  dwState:    %s (0x%08" PRIX32 ")", state, ret->dwState);
+       WLog_LVL(TAG, g_LogLevel, "  dwProtocol: %s (0x%08" PRIX32 ")",
+                SCardGetProtocolString(ret->dwProtocol), ret->dwProtocol);
+       WLog_LVL(TAG, g_LogLevel, "  cbAtrLen:      (0x%08" PRIX32 ")", ret->cbAtrLen);
        WLog_LVL(TAG, g_LogLevel, "  rgAtr:      %s",
                 smartcard_array_dump(ret->rgAtr, sizeof(ret->rgAtr), buffer, sizeof(buffer)));
        WLog_LVL(TAG, g_LogLevel, "}");
+       free(state);
 }
 
 static void smartcard_trace_reconnect_return(SMARTCARD_DEVICE* smartcard,