[emu,scard] fix integer narrow

This commit is contained in:
akallabeth 2024-09-25 02:47:26 +02:00
parent e13273d94d
commit b5dbe5a167
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -502,7 +502,7 @@ handle_error:
return FALSE; return FALSE;
} }
static int get_rsa_key_size(const rdpPrivateKey* privateKey) static size_t get_rsa_key_size(const rdpPrivateKey* privateKey)
{ {
WINPR_ASSERT(privateKey); WINPR_ASSERT(privateKey);
@ -1523,8 +1523,8 @@ BOOL vgids_init(vgidsContext* ctx, const char* cert, const char* privateKey, con
goto init_failed; goto init_failed;
/* write container map DO */ /* write container map DO */
const int size = get_rsa_key_size(ctx->privateKey); const size_t size = get_rsa_key_size(ctx->privateKey);
if (size <= 0) if ((size == 0) || (size > UINT16_MAX / 8))
goto init_failed; goto init_failed;
cmrec.wKeyExchangeKeySizeBits = (WORD)size * 8; cmrec.wKeyExchangeKeySizeBits = (WORD)size * 8;