[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 4114bcc9ef)

Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
Miss Islington (bot) 2022-10-04 10:06:17 -07:00 committed by GitHub
parent 41188134bd
commit 938223e8d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -0,0 +1 @@
Fixes a potential buffer overrun in :mod:`msilib`.

View File

@ -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))