diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-09-07 15:15:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-07 15:15:30 -0700 |
commit | 73994077250bd70385cb8e7a92f24874129369d1 (patch) | |
tree | b830e2aeb8d701b07d509b2fcf01e182131ada02 /PC | |
parent | 18d7dff1bb6f5ca7060b0b2e2a2e74493619178f (diff) | |
download | cpython-git-73994077250bd70385cb8e7a92f24874129369d1.tar.gz |
bpo-23855: Add missing NULL checks for malloc() in _msi.c (GH-9038)
(cherry picked from commit 4e519377b1b84c9414a360961276993d24198825)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'PC')
-rw-r--r-- | PC/_msi.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -330,6 +330,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'; } @@ -560,6 +564,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); } |