mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
Fix possible crashes in pwdmodule.c. (GH-10331)
"p" was not initialized if the first PyMem_RawRealloc() call failed.
This commit is contained in:
parent
083a7a172b
commit
570e371fd6
1 changed files with 2 additions and 0 deletions
|
|
@ -145,6 +145,7 @@ pwd_getpwuid(PyObject *module, PyObject *uidobj)
|
||||||
while(1) {
|
while(1) {
|
||||||
buf2 = PyMem_RawRealloc(buf, bufsize);
|
buf2 = PyMem_RawRealloc(buf, bufsize);
|
||||||
if (buf2 == NULL) {
|
if (buf2 == NULL) {
|
||||||
|
p = NULL;
|
||||||
nomem = 1;
|
nomem = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -227,6 +228,7 @@ pwd_getpwnam_impl(PyObject *module, PyObject *name)
|
||||||
while(1) {
|
while(1) {
|
||||||
buf2 = PyMem_RawRealloc(buf, bufsize);
|
buf2 = PyMem_RawRealloc(buf, bufsize);
|
||||||
if (buf2 == NULL) {
|
if (buf2 == NULL) {
|
||||||
|
p = NULL;
|
||||||
nomem = 1;
|
nomem = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue