Bug report
Here's what's wrong:
|
PyObject *o = PyUnicode_DecodeFSDefault(val); |
|
PyStructSequence_SET_ITEM(v, i, o); |
|
} |
is not checked to be NULL, while it is possible
- All errors here can overwrite each other:
|
#define SETS(i,val) sets(v, i, val) |
|
|
|
SETS(setIndex++, p->pw_name); |
|
#if defined(HAVE_STRUCT_PASSWD_PW_PASSWD) && !defined(__ANDROID__) |
|
SETS(setIndex++, p->pw_passwd); |
|
#else |
|
SETS(setIndex++, ""); |
|
#endif |
|
PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid)); |
|
PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid)); |
|
#if defined(HAVE_STRUCT_PASSWD_PW_GECOS) |
|
SETS(setIndex++, p->pw_gecos); |
|
#else |
|
SETS(setIndex++, ""); |
|
#endif |
|
SETS(setIndex++, p->pw_dir); |
|
SETS(setIndex++, p->pw_shell); |
XDECREF used, while v cannot be NULL:
I will send a PR with the fix.
Linked PRs
Bug report
Here's what's wrong:
cpython/Modules/pwdmodule.c
Lines 71 to 73 in b9cb855
NULL, while it is possiblecpython/Modules/pwdmodule.c
Lines 88 to 104 in b9cb855
XDECREFused, whilevcannot beNULL:cpython/Modules/pwdmodule.c
Line 109 in b9cb855
I will send a PR with the fix.
Linked PRs
mkpwentinpwdmodule#116548mkpwentinpwdmodule(GH-116548) #116593mkpwentinpwdmodule(GH-116548) #116594