mirror of https://github.com/python/cpython
gh-96577: Fixes buffer overrun in _msi module (GH-96633)
This commit is contained in:
parent
3eaf70d836
commit
4114bcc9ef
|
@ -0,0 +1 @@
|
||||||
|
Fixes a potential buffer overrun in :mod:`msilib`.
|
|
@ -360,7 +360,7 @@ msierror(int status)
|
||||||
int code;
|
int code;
|
||||||
char buf[2000];
|
char buf[2000];
|
||||||
char *res = buf;
|
char *res = buf;
|
||||||
DWORD size = sizeof(buf);
|
DWORD size = Py_ARRAY_LENGTH(buf);
|
||||||
MSIHANDLE err = MsiGetLastErrorRecord();
|
MSIHANDLE err = MsiGetLastErrorRecord();
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
|
@ -484,7 +484,7 @@ _msi_Record_GetString_impl(msiobj *self, unsigned int field)
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
WCHAR buf[2000];
|
WCHAR buf[2000];
|
||||||
WCHAR *res = buf;
|
WCHAR *res = buf;
|
||||||
DWORD size = sizeof(buf);
|
DWORD size = Py_ARRAY_LENGTH(buf);
|
||||||
PyObject* string;
|
PyObject* string;
|
||||||
|
|
||||||
status = MsiRecordGetStringW(self->h, field, res, &size);
|
status = MsiRecordGetStringW(self->h, field, res, &size);
|
||||||
|
|
Loading…
Reference in New Issue