diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-09-12 17:37:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-12 20:37:33 -0400 |
commit | 8fc2635995797b18eb88fd8a1374597dfc9c55f0 (patch) | |
tree | 8c4aa056b407f786a989b91d07f8e0ce2b3cda3c | |
parent | 086cca46d18addba1f3472098a5f1963220506d3 (diff) | |
download | cpython-git-8fc2635995797b18eb88fd8a1374597dfc9c55f0.tar.gz |
gh-96577: Fixes buffer overrun in _msi module (GH-96633) (GH-96659)
(cherry picked from commit 4114bcc9ef7595a07196bcecf9c7d6d39f57f64d)
Co-authored-by: Steve Dower <steve.dower@python.org>
-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`. @@ -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)) |