[issue7900] posix.getgroups() failure on Mac OS X

Alexander Belopolsky report at bugs.python.org
Wed May 5 20:22:57 CEST 2010


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

The latest patch, os-getgroups-v2.patch, seems to have the same bug as I reported in msg99926:

"""
The crash that I see is apparently due to underallocated  memory:

 alt_grouplist = PyMem_Malloc(n);

should be

 alt_grouplist = PyMem_Malloc(n * sizeof(gid_t));
"""

I no longer see the crash, but did not have a chance to investigate it further.  In any case, PyMem_Malloc(n) is clearly wrong and should be replaced by PyMem_Malloc(n * sizeof(gid_t)) or maybe better by PyMem_New(gid_t, n).

There are no tests in the patch and issue7900-tests.diff tests return "FAILED (failures=3, errors=2)" when ran as a superuser.

----------
nosy: +belopolsky -Alexander.Belopolsky
stage: patch review -> unit test needed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7900>
_______________________________________


More information about the Python-bugs-list mailing list