From 570e371fd6e8615ece9b9e21fbe77149ebeb172e Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Mon, 5 Nov 2018 12:26:40 -0700 Subject: [PATCH] Fix possible crashes in pwdmodule.c. (GH-10331) "p" was not initialized if the first PyMem_RawRealloc() call failed. --- Modules/pwdmodule.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index 1286e7d5ce5..fd11f848b2c 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; }