Fix possible crashes in pwdmodule.c. (GH-10331)

"p" was not initialized if the first PyMem_RawRealloc() call failed.
This commit is contained in:
Zackery Spytz 2018-11-05 12:26:40 -07:00 committed by Serhiy Storchaka
parent 083a7a172b
commit 570e371fd6
1 changed files with 2 additions and 0 deletions

View File

@ -145,6 +145,7 @@ pwd_getpwuid(PyObject *module, PyObject *uidobj)
while(1) {
buf2 = PyMem_RawRealloc(buf, bufsize);
if (buf2 == NULL) {
p = NULL;
nomem = 1;
break;
}
@ -227,6 +228,7 @@ pwd_getpwnam_impl(PyObject *module, PyObject *name)
while(1) {
buf2 = PyMem_RawRealloc(buf, bufsize);
if (buf2 == NULL) {
p = NULL;
nomem = 1;
break;
}