[pypy-svn] r56364 - pypy/dist/pypy/lib

haypo at codespeak.net haypo at codespeak.net
Tue Jul 8 01:21:11 CEST 2008


Author: haypo
Date: Tue Jul  8 01:21:09 2008
New Revision: 56364

Modified:
   pypy/dist/pypy/lib/pwd.py
Log:
Fix getpwnam(): check name type to avoid segfault, eg. getpwnam(False)


Modified: pypy/dist/pypy/lib/pwd.py
==============================================================================
--- pypy/dist/pypy/lib/pwd.py	(original)
+++ pypy/dist/pypy/lib/pwd.py	Tue Jul  8 01:21:09 2008
@@ -98,6 +98,8 @@
     Return the password database entry for the given user name.
     See pwd.__doc__ for more on password database entries.
     """
+    if not isinstance(name, str):
+        raise TypeError("expected string")
     pw = _getpwnam(name)
     if not pw:
         raise KeyError("getpwname(): name not found: %s" % name)



More information about the Pypy-commit mailing list