[Python-checkins] Fix possible crashes in pwdmodule.c. (GH-10331)
Serhiy Storchaka
webhook-mailer at python.org
Mon Nov 5 14:26:43 EST 2018
https://github.com/python/cpython/commit/570e371fd6e8615ece9b9e21fbe77149ebeb172e
commit: 570e371fd6e8615ece9b9e21fbe77149ebeb172e
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-11-05T21:26:40+02:00
summary:
Fix possible crashes in pwdmodule.c. (GH-10331)
"p" was not initialized if the first PyMem_RawRealloc() call failed.
files:
M Modules/pwdmodule.c
diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c
index 1286e7d5ce59..fd11f848b2ce 100644
--- a/Modules/pwdmodule.c
+++ b/Modules/pwdmodule.c
@@ -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;
}
More information about the Python-checkins
mailing list