Dereference ppbAttr as argument for SCardGetAttrib
authorakallabeth <akallabeth@posteo.net>
Tue, 26 Jan 2021 16:22:42 +0000 (17:22 +0100)
committerakallabeth <akallabeth@users.noreply.github.com>
Thu, 25 Feb 2021 08:51:41 +0000 (09:51 +0100)
(cherry picked from commit 1efcd605e02bdbe54121d9f1da85d6874c26f59e)

channels/smartcard/client/smartcard_operations.c

index da86ff8..ad17ccc 100644 (file)
@@ -1866,7 +1866,7 @@ static LONG smartcard_GetAttrib_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD_OPER
        BOOL autoAllocate = FALSE;
        LONG status;
        DWORD cbAttrLen = 0;
-       LPBYTE pbAttr = NULL;
+       LPBYTE* ppbAttr = NULL;
        GetAttrib_Return ret = { 0 };
        IRP* irp = operation->irp;
        const GetAttrib_Call* call = operation->call;
@@ -1874,7 +1874,7 @@ static LONG smartcard_GetAttrib_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD_OPER
        if (!call->fpbAttrIsNULL)
        {
                autoAllocate = (call->cbAttrLen == SCARD_AUTOALLOCATE) ? TRUE : FALSE;
-               pbAttr = autoAllocate ? (LPBYTE) & (ret.pbAttr) : ret.pbAttr;
+               *ppbAttr = autoAllocate ? (LPBYTE) & (ret.pbAttr) : ret.pbAttr;
                cbAttrLen = call->cbAttrLen;
        }
 
@@ -1886,7 +1886,8 @@ static LONG smartcard_GetAttrib_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD_OPER
                        return SCARD_E_NO_MEMORY;
        }
 
-       ret.ReturnCode = SCardGetAttrib(operation->hCard, call->dwAttrId, pbAttr, &cbAttrLen);
+       ret.ReturnCode = SCardGetAttrib(operation->hCard, call->dwAttrId, *ppbAttr, &cbAttrLen);
+
        log_status_error(TAG, "SCardGetAttrib", ret.ReturnCode);
        ret.cbAttrLen = cbAttrLen;