summaryrefslogtreecommitdiffstats
path: root/Modules/grpmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/grpmodule.c')
-rw-r--r--Modules/grpmodule.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c
index 57cdde6..f570929 100644
--- a/Modules/grpmodule.c
+++ b/Modules/grpmodule.c
@@ -65,8 +65,14 @@ mkgrent(PyObject *module, struct group *p)
Py_DECREF(v);
return NULL;
}
- for (member = p->gr_mem; *member != NULL; member++) {
- PyObject *x = PyUnicode_DecodeFSDefault(*member);
+ for (member = p->gr_mem; ; member++) {
+ char *group_member;
+ // member can be misaligned
+ memcpy(&group_member, member, sizeof(group_member));
+ if (group_member == NULL) {
+ break;
+ }
+ PyObject *x = PyUnicode_DecodeFSDefault(group_member);
if (x == NULL || PyList_Append(w, x) != 0) {
Py_XDECREF(x);
Py_DECREF(w);