Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 570e371

Browse files
ZackerySpytzserhiy-storchaka
authored andcommitted
Fix possible crashes in pwdmodule.c. (GH-10331)
"p" was not initialized if the first PyMem_RawRealloc() call failed.
1 parent 083a7a1 commit 570e371

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Modules/pwdmodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ pwd_getpwuid(PyObject *module, PyObject *uidobj)
145145
while(1) {
146146
buf2 = PyMem_RawRealloc(buf, bufsize);
147147
if (buf2 == NULL) {
148+
p = NULL;
148149
nomem = 1;
149150
break;
150151
}
@@ -227,6 +228,7 @@ pwd_getpwnam_impl(PyObject *module, PyObject *name)
227228
while(1) {
228229
buf2 = PyMem_RawRealloc(buf, bufsize);
229230
if (buf2 == NULL) {
231+
p = NULL;
230232
nomem = 1;
231233
break;
232234
}

0 commit comments

Comments
 (0)