summaryrefslogtreecommitdiffstats
path: root/PC/_msi.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-10-04 17:06:17 (GMT)
committerGitHub <noreply@github.com>2022-10-04 17:06:17 (GMT)
commit938223e8d1eabdd6a73531a8dd52407ef23f6375 (patch)
treebd405cf9aa3cc219b3933c17aa8484905fbfd298 /PC/_msi.c
parent41188134bd2120f0cedd681ed88743c11c7f3742 (diff)
downloadcpython-938223e8d1eabdd6a73531a8dd52407ef23f6375.zip
cpython-938223e8d1eabdd6a73531a8dd52407ef23f6375.tar.gz
cpython-938223e8d1eabdd6a73531a8dd52407ef23f6375.tar.bz2
[3.9] gh-96577: Fixes buffer overrun in _msi module (GH-96633) (GH-96657)
gh-96577: Fixes buffer overrun in _msi module (GH-96633) (cherry picked from commit 4114bcc9ef7595a07196bcecf9c7d6d39f57f64d) Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'PC/_msi.c')
-rw-r--r--PC/_msi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/PC/_msi.c b/PC/_msi.c
index 913d3b8..fd68e1d 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -292,7 +292,7 @@ msierror(int status)
int code;
char buf[2000];
char *res = buf;
- DWORD size = sizeof(buf);
+ DWORD size = Py_ARRAY_LENGTH(buf);
MSIHANDLE err = MsiGetLastErrorRecord();
if (err == 0) {
@@ -386,7 +386,7 @@ record_getstring(msiobj* record, PyObject* args)
unsigned int status;
WCHAR buf[2000];
WCHAR *res = buf;
- DWORD size = sizeof(buf);
+ DWORD size = Py_ARRAY_LENGTH(buf);
PyObject* string;
if (!PyArg_ParseTuple(args, "I:GetString", &field))