File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -857,7 +857,6 @@ def test_one_environment_variable(self):
857857 self .assertEqual (p .returncode , 0 )
858858 self .assertEqual (stdout .strip (), b"fruit=orange" )
859859
860- @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON, null byte is not checked" )
861860 def test_invalid_cmd (self ):
862861 # null character in the command name
863862 cmd = sys .executable + '\0 '
Original file line number Diff line number Diff line change @@ -248,6 +248,18 @@ mod _winapi {
248248 Ok ( ws. into_vec_with_nul ( ) )
249249 } ;
250250
251+ // Validate no embedded null bytes in command name and command line
252+ if let Some ( ref name) = args. name
253+ && name. as_str ( ) . contains ( '\0' )
254+ {
255+ return Err ( crate :: exceptions:: cstring_error ( vm) ) ;
256+ }
257+ if let Some ( ref cmd) = args. command_line
258+ && cmd. as_str ( ) . contains ( '\0' )
259+ {
260+ return Err ( crate :: exceptions:: cstring_error ( vm) ) ;
261+ }
262+
251263 let app_name = args. name . map ( wstr) . transpose ( ) ?;
252264 let app_name = app_name. as_ref ( ) . map_or_else ( null, |w| w. as_ptr ( ) ) ;
253265
You can’t perform that action at this time.
0 commit comments