mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
Fix test_subprocess
This commit is contained in:
1 parent
5a5b721576
commit
b9fa405fd4
2 files changed
+12
-1
No files matched your search
Vendored
-1
@@ -857,7 +857,6 @@ class ProcessTestCase(BaseTestCase):
|
||||
self.assertEqual(p.returncode, 0)
|
||||
self.assertEqual(stdout.strip(), b"fruit=orange")
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON, null byte is not checked")
|
||||
def test_invalid_cmd(self):
|
||||
# null character in the command name
|
||||
cmd = sys.executable + '\0'
|
||||
|
||||
@@ -248,6 +248,18 @@ mod _winapi {
|
||||
Ok(ws.into_vec_with_nul())
|
||||
};
|
||||
|
||||
// Validate no embedded null bytes in command name and command line
|
||||
if let Some(ref name) = args.name
|
||||
&& name.as_str().contains('\0')
|
||||
{
|
||||
return Err(crate::exceptions::cstring_error(vm));
|
||||
}
|
||||
if let Some(ref cmd) = args.command_line
|
||||
&& cmd.as_str().contains('\0')
|
||||
{
|
||||
return Err(crate::exceptions::cstring_error(vm));
|
||||
}
|
||||
|
||||
let app_name = args.name.map(wstr).transpose()?;
|
||||
let app_name = app_name.as_ref().map_or_else(null, |w| w.as_ptr());
|
||||
|
||||
|
||||
Reference in new issue
Block a user