Fix possible crashes in pwdmodule.c. (GH-10331)
![](https://secure.gravatar.com/avatar/cc7737cd64a84f1b5c61a160798e97ee.jpg?s=120&d=mm&r=g)
https://github.com/python/cpython/commit/570e371fd6e8615ece9b9e21fbe77149ebe... commit: 570e371fd6e8615ece9b9e21fbe77149ebeb172e branch: master author: Zackery Spytz <zspytz@gmail.com> committer: Serhiy Storchaka <storchaka@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; }
participants (1)
-
Serhiy Storchaka