mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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:
parent
295f510f5a
commit
9fa21d050a
2 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue