Commit f51a4663 authored by Miss Islington (bot)'s avatar Miss Islington (bot) Committed by GitHub

bpo-23855: Add missing NULL checks for malloc() in _msi.c (GH-9038)

(cherry picked from commit 4e519377)
Co-authored-by: default avatarZackery Spytz <zspytz@gmail.com>
parent bf2bd8f8
......@@ -321,6 +321,10 @@ msierror(int status)
code = MsiRecordGetInteger(err, 1); /* XXX code */
if (MsiFormatRecord(0, err, res, &size) == ERROR_MORE_DATA) {
res = malloc(size+1);
if (res == NULL) {
MsiCloseHandle(err);
return PyErr_NoMemory();
}
MsiFormatRecord(0, err, res, &size);
res[size]='\0';
}
......@@ -544,6 +548,9 @@ summary_getproperty(msiobj* si, PyObject *args)
&fval, sval, &ssize);
if (status == ERROR_MORE_DATA) {
sval = malloc(ssize);
if (sval == NULL) {
return PyErr_NoMemory();
}
status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
&fval, sval, &ssize);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment