Kaydet (Commit) 570e371f authored tarafından Zackery Spytz's avatar Zackery Spytz Kaydeden (comit) Serhiy Storchaka

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

"p" was not initialized if the first PyMem_RawRealloc() call failed.
üst 083a7a17
...@@ -145,6 +145,7 @@ pwd_getpwuid(PyObject *module, PyObject *uidobj) ...@@ -145,6 +145,7 @@ pwd_getpwuid(PyObject *module, PyObject *uidobj)
while(1) { while(1) {
buf2 = PyMem_RawRealloc(buf, bufsize); buf2 = PyMem_RawRealloc(buf, bufsize);
if (buf2 == NULL) { if (buf2 == NULL) {
p = NULL;
nomem = 1; nomem = 1;
break; break;
} }
...@@ -227,6 +228,7 @@ pwd_getpwnam_impl(PyObject *module, PyObject *name) ...@@ -227,6 +228,7 @@ pwd_getpwnam_impl(PyObject *module, PyObject *name)
while(1) { while(1) {
buf2 = PyMem_RawRealloc(buf, bufsize); buf2 = PyMem_RawRealloc(buf, bufsize);
if (buf2 == NULL) { if (buf2 == NULL) {
p = NULL;
nomem = 1; nomem = 1;
break; break;
} }
......
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