From 5d61ab1eac496bda67d67dd6b55218327313fc61 Mon Sep 17 00:00:00 2001 From: Hodol Han Date: Thu, 3 Aug 2023 20:49:14 +0900 Subject: [PATCH] [client,common] Fix freerdp_client_register_pen Pass null device id rather than `deviceid` to find an empty pen device slot. --- client/common/client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/common/client.c b/client/common/client.c index a15356aad..e4c725e7d 100644 --- a/client/common/client.c +++ b/client/common/client.c @@ -1887,6 +1887,8 @@ static FreeRDP_PenDevice* freerdp_client_get_pen(rdpClientContext* cctx, INT32 d static BOOL freerdp_client_register_pen(rdpClientContext* cctx, UINT32 flags, INT32 deviceid, double pressure) { + static const INT32 null_deviceid = 0; + WINPR_ASSERT(cctx); WINPR_ASSERT((flags & FREERDP_PEN_REGISTER) != 0); if (freerdp_client_is_pen(cctx, deviceid)) @@ -1896,7 +1898,7 @@ static BOOL freerdp_client_register_pen(rdpClientContext* cctx, UINT32 flags, IN } size_t pos = 0; - FreeRDP_PenDevice* pen = freerdp_client_get_pen(cctx, deviceid, &pos); + FreeRDP_PenDevice* pen = freerdp_client_get_pen(cctx, null_deviceid, &pos); if (pen) { const FreeRDP_PenDevice empty = { 0 };