From: Zackery Spytz Date: Mon, 5 Nov 2018 19:26:40 +0000 (-0700) Subject: Fix possible crashes in pwdmodule.c. (GH-10331) X-Git-Tag: v3.8.0a1~574 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=570e371fd6e8615ece9b9e21fbe77149ebeb172e;p=python Fix possible crashes in pwdmodule.c. (GH-10331) "p" was not initialized if the first PyMem_RawRealloc() call failed. --- diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index 1286e7d5ce..fd11f848b2 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; }