37 lines
1.5 KiB
Diff
37 lines
1.5 KiB
Diff
From 2a6d532a1d633145ae48e55ae471f2f2d8e56157 Mon Sep 17 00:00:00 2001
|
|
From: Armin Novak <armin.novak@thincast.com>
|
|
Date: Fri, 19 Jun 2026 20:15:15 +0200
|
|
Subject: [PATCH] [utils,scard] fix endianess issue
|
|
|
|
---
|
|
libfreerdp/utils/smartcard_pack.c | 9 +++++----
|
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/libfreerdp/utils/smartcard_pack.c b/libfreerdp/utils/smartcard_pack.c
|
|
index bb977c4..83d1fbd 100644
|
|
--- a/libfreerdp/utils/smartcard_pack.c
|
|
+++ b/libfreerdp/utils/smartcard_pack.c
|
|
@@ -319,14 +319,15 @@ static LONG smartcard_ndr_read_atrmask(wLog* log, wStream* s, LocateCards_ATRMas
|
|
/* [MS-RDPESC] 2.2.1.5: cbAtr is range(0..36), the number of valid bytes in the fixed
|
|
* rgbAtr/rgbMask arrays. A larger value walks past them when the mask is compared byte
|
|
* by byte, so reject it here rather than trusting the wire value. */
|
|
- const LocateCards_ATRMask* masks = *data;
|
|
+ LocateCards_ATRMask* masks = *data;
|
|
for (size_t x = 0; x < min; x++)
|
|
{
|
|
- if (masks[x].cbAtr > ARRAYSIZE(masks[x].rgbAtr))
|
|
+ const UINT32 val = winpr_Data_Get_UINT32(&masks[x].cbAtr);
|
|
+ if (val > ARRAYSIZE(masks[x].rgbAtr))
|
|
{
|
|
WLog_Print(log, WLOG_ERROR,
|
|
- "LocateCards_ATRMask[%" PRIuz "]::cbAtr %" PRIu32 " exceeds %" PRIuz, x,
|
|
- masks[x].cbAtr, (size_t)ARRAYSIZE(masks[x].rgbAtr));
|
|
+ "LocateCards_ATRMask[%" PRIuz "]::cbAtr %" PRIu32 " exceeds %" PRIuz, x, val,
|
|
+ (size_t)ARRAYSIZE(masks[x].rgbAtr));
|
|
free(*data);
|
|
*data = nullptr;
|
|
return STATUS_DATA_ERROR;
|
|
--
|
|
2.54.0
|
|
|