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
|
@ -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…
Reference in New Issue