Jacek Caban : propsys: Allow only ASCII digits in PSPropertyKeyFromString.

Alexandre Julliard julliard at winehq.org
Thu Feb 6 15:44:17 CST 2020


Module: wine
Branch: master
Commit: 6e8c2d836e637e1fbd83c231cfd846ecb9333964
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6e8c2d836e637e1fbd83c231cfd846ecb9333964

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Feb  6 14:00:25 2020 +0100

propsys: Allow only ASCII digits in PSPropertyKeyFromString.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/propsys/propsys_main.c  | 2 +-
 dlls/propsys/tests/propsys.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/propsys/propsys_main.c b/dlls/propsys/propsys_main.c
index 7ae3870efb..75963d7b6c 100644
--- a/dlls/propsys/propsys_main.c
+++ b/dlls/propsys/propsys_main.c
@@ -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');
diff --git a/dlls/propsys/tests/propsys.c b/dlls/propsys/tests/propsys.c
index 191a154744..ccd075a959 100644
--- a/dlls/propsys/tests/propsys.c
+++ b/dlls/propsys/tests/propsys.c
@@ -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;




More information about the wine-cvs mailing list