[Python-checkins] bpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766)

Jason R. Coombs webhook-mailer at python.org
Mon Sep 9 09:24:19 EDT 2019


https://github.com/python/cpython/commit/ef66f31ce21cd759cc0c618c5c42ba6da0a06834
commit: ef66f31ce21cd759cc0c618c5c42ba6da0a06834
branch: master
author: Steve Dower <steve.dower at python.org>
committer: Jason R. Coombs <jaraco at jaraco.com>
date: 2019-09-09T14:24:15+01:00
summary:

bpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766)

files:
M PC/winreg.c

diff --git a/PC/winreg.c b/PC/winreg.c
index 37bc2c72dcde..72a7c380beef 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -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);
 



More information about the Python-checkins mailing list