]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
\bgh-95376: Add test for names containing null (#GH-5394)
authorSion Kang <31057849+Yaminyam@users.noreply.github.com>
Sat, 6 Aug 2022 16:53:19 +0000 (01:53 +0900)
committerGitHub <noreply@github.com>
Sat, 6 Aug 2022 16:53:19 +0000 (18:53 +0200)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
Lib/test/test_pwd.py

index c789326425be32302f21bbf5a00a5f77d81bcc05..aa090b464a72222f132c692b3b84a3be972e544b 100644 (file)
@@ -59,6 +59,8 @@ class PwdTest(unittest.TestCase):
         self.assertRaises(TypeError, pwd.getpwnam)
         self.assertRaises(TypeError, pwd.getpwnam, 42)
         self.assertRaises(TypeError, pwd.getpwall, 42)
+        # embedded null character
+        self.assertRaisesRegex(ValueError, 'null', pwd.getpwnam, 'a\x00b')
 
         # try to get some errors
         bynames = {}