Blame SOURCES/fix-channels-smartcard-fix-StatusW_Call.patch

da3252
From a311075202865d22b87ec2ea8d1e32fa11868012 Mon Sep 17 00:00:00 2001
da3252
From: Bernhard Miklautz <bernhard.miklautz@thincast.com>
da3252
Date: Wed, 10 Jul 2019 18:36:34 +0200
da3252
Subject: [PATCH] fix [channels/smartcard]: fix StatusW_Call
da3252
da3252
According to 2.2.2.18 Status_Call cbAtrLen is unused an must be ignored
da3252
upon receipt.
da3252
---
da3252
 channels/smartcard/client/smartcard_operations.c | 13 ++++++++-----
da3252
 1 file changed, 8 insertions(+), 5 deletions(-)
da3252
da3252
diff --git a/channels/smartcard/client/smartcard_operations.c b/channels/smartcard/client/smartcard_operations.c
da3252
index c4bf65d38..e3d848171 100644
da3252
--- a/channels/smartcard/client/smartcard_operations.c
da3252
+++ b/channels/smartcard/client/smartcard_operations.c
da3252
@@ -1209,15 +1209,19 @@ static LONG smartcard_StatusW_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD_OPERAT
da3252
 	Status_Call* call = operation->call;
da3252
 	DWORD cbAtrLen;
da3252
 
da3252
-	if (call->cbAtrLen > 32)
da3252
-		call->cbAtrLen = 32;
da3252
+	/**
da3252
+	 * [MS-RDPESC]
da3252
+	 * According to 2.2.2.18 Status_Call cbAtrLen is unused an must be ignored upon receipt.
da3252
+	 */
da3252
+	cbAtrLen = call->cbAtrLen = 32;
da3252
+
da3252
+	call->cchReaderLen;
da3252
 
da3252
 	if (call->fmszReaderNamesIsNULL)
da3252
 		cchReaderLen = 0;
da3252
 	else
da3252
 		cchReaderLen = SCARD_AUTOALLOCATE;
da3252
 
da3252
-	cbAtrLen = call->cbAtrLen;
da3252
 	ZeroMemory(ret.pbAtr, 32);
da3252
 	status = ret.ReturnCode = SCardStatusW(operation->hCard,
da3252
 	                                       call->fmszReaderNamesIsNULL ? NULL : (LPWSTR) &mszReaderNames,
da3252
@@ -1236,8 +1240,7 @@ static LONG smartcard_StatusW_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD_OPERAT
da3252
 		ret.cBytes = cchReaderLen;
da3252
 #endif
da3252
 
da3252
-		if (call->cbAtrLen)
da3252
-			ret.cbAtrLen = cbAtrLen;
da3252
+		ret.cbAtrLen = cbAtrLen;
da3252
 	}
da3252
 
da3252
 	smartcard_trace_status_return(smartcard, &ret, TRUE);
da3252
-- 
da3252
2.26.0
da3252