summaryrefslogtreecommitdiffstats
path: root/PC/_msi.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2022-09-07 17:01:35 (GMT)
committerGitHub <noreply@github.com>2022-09-07 17:01:35 (GMT)
commit4114bcc9ef7595a07196bcecf9c7d6d39f57f64d (patch)
tree6f040b105d1a01a7e2011155bd654bd9b6075418 /PC/_msi.c
parent3eaf70d8369a7d78f3e21949e438c8ff8a30f433 (diff)
downloadcpython-4114bcc9ef7595a07196bcecf9c7d6d39f57f64d.zip
cpython-4114bcc9ef7595a07196bcecf9c7d6d39f57f64d.tar.gz
cpython-4114bcc9ef7595a07196bcecf9c7d6d39f57f64d.tar.bz2
gh-96577: Fixes buffer overrun in _msi module (GH-96633)
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 3f50f9b..3686b9b 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -360,7 +360,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) {
@@ -484,7 +484,7 @@ _msi_Record_GetString_impl(msiobj *self, unsigned int field)
unsigned int status;
WCHAR buf[2000];
WCHAR *res = buf;
- DWORD size = sizeof(buf);
+ DWORD size = Py_ARRAY_LENGTH(buf);
PyObject* string;
status = MsiRecordGetStringW(self->h, field, res, &size);