propsys: Allow only ASCII digits in PSPropertyKeyFromString.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-02-06 14:00:25 +01:00 committed by Alexandre Julliard
parent 275f6ca3df
commit 6e8c2d836e
2 changed files with 5 additions and 1 deletions

View File

@ -495,7 +495,7 @@ HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR pszString, PROPERTYKEY *pkey)
}
/* Overflow is not checked. */
while (iswdigit(*pszString))
while ('0' <= *pszString && *pszString <= '9')
{
pkey->pid *= 10;
pkey->pid += (*pszString - '0');

View File

@ -346,6 +346,9 @@ static void test_PSPropertyKeyFromString(void)
static const WCHAR fmtid_normalpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
'1','2','3','4','-','1','2','3','4','-',
'1','2','3','4','5','6','7','8','9','0','1','2','}',' ','1','3','5','7','9',0};
static const WCHAR fmtid_udigitW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
'1','2','3','4','-','1','2','3','4','-',
'1','2','3','4','5','6','7','8','9','0','1','2','}',' ','1','2','3',0x661,'5','7','9',0};
PROPERTYKEY out_init = {GUID_MEMBERS(dummy_guid), 0xdeadbeef};
PROPERTYKEY out;
HRESULT ret;
@ -422,6 +425,7 @@ static void test_PSPropertyKeyFromString(void)
{fmtid_commanegspcpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0U}},
{fmtid_negcommapidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
{fmtid_normalpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
{fmtid_udigitW, &out, S_OK, {GUID_MEMBERS(expect_guid), 123}},
};
int i;