diff options
author | Steve Dower <steve.dower@python.org> | 2022-09-07 18:01:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-07 18:01:35 +0100 |
commit | 4114bcc9ef7595a07196bcecf9c7d6d39f57f64d (patch) | |
tree | 6f040b105d1a01a7e2011155bd654bd9b6075418 | |
parent | 3eaf70d8369a7d78f3e21949e438c8ff8a30f433 (diff) | |
download | cpython-git-4114bcc9ef7595a07196bcecf9c7d6d39f57f64d.tar.gz |
gh-96577: Fixes buffer overrun in _msi module (GH-96633)
-rw-r--r-- | Misc/NEWS.d/next/Windows/2022-09-07-00-11-33.gh-issue-96577.kV4K_1.rst | 1 | ||||
-rw-r--r-- | PC/_msi.c | 4 |
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 0000000000..6025e5ce41 --- /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`. @@ -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); |