summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Windows/2022-09-07-00-11-33.gh-issue-96577.kV4K_1.rst1
-rw-r--r--PC/_msi.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Windows/2022-09-07-00-11-33.gh-issue-96577.kV4K_1.rst b/Misc/NEWS.d/next/Windows/2022-09-07-00-11-33.gh-issue-96577.kV4K_1.rst
new file mode 100644
index 0000000..6025e5c
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2022-09-07-00-11-33.gh-issue-96577.kV4K_1.rst
@@ -0,0 +1 @@
+Fixes a potential buffer overrun in :mod:`msilib`.
diff --git a/PC/_msi.c b/PC/_msi.c
index 5079a52..0b92712 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))