]> granicus.if.org Git - python/commitdiff
bpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 9 Sep 2019 14:23:37 +0000 (07:23 -0700)
committerGitHub <noreply@github.com>
Mon, 9 Sep 2019 14:23:37 +0000 (07:23 -0700)
(cherry picked from commit ef66f31ce21cd759cc0c618c5c42ba6da0a06834)

Co-authored-by: Steve Dower <steve.dower@python.org>
PC/winreg.c

index 37bc2c72dcdee13db04c3c30a5693e26e7ffcd9a..72a7c380beefe1eecbf2a93f80610f7093188dbf 100644 (file)
@@ -772,7 +772,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
                         return NULL;
                     }
                     PyList_SET_ITEM(obData, index, uni);
-                    len -= slen + 1;
+                    len -= Py_SAFE_DOWNCAST(slen + 1, size_t, int);
                 }
                 PyMem_Free(str);