Skip to content

Commit 4114bcc

Browse files
authored
gh-96577: Fixes buffer overrun in _msi module (GH-96633)
1 parent 3eaf70d commit 4114bcc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes a potential buffer overrun in :mod:`msilib`.

PC/_msi.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ msierror(int status)
360360
int code;
361361
char buf[2000];
362362
char *res = buf;
363-
DWORD size = sizeof(buf);
363+
DWORD size = Py_ARRAY_LENGTH(buf);
364364
MSIHANDLE err = MsiGetLastErrorRecord();
365365

366366
if (err == 0) {
@@ -484,7 +484,7 @@ _msi_Record_GetString_impl(msiobj *self, unsigned int field)
484484
unsigned int status;
485485
WCHAR buf[2000];
486486
WCHAR *res = buf;
487-
DWORD size = sizeof(buf);
487+
DWORD size = Py_ARRAY_LENGTH(buf);
488488
PyObject* string;
489489

490490
status = MsiRecordGetStringW(self->h, field, res, &size);

0 commit comments

Comments
 (0)