Skip to content

Commit 6f664cb

Browse files
committed
Fix initgroups nul error
1 parent a8ea671 commit 6f664cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

vm/src/stdlib/posix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ pub mod module {
13381338
))]
13391339
#[pyfunction]
13401340
fn initgroups(user_name: PyStrRef, gid: Option<Gid>, vm: &VirtualMachine) -> PyResult<()> {
1341-
let user = CString::new(user_name.as_str()).unwrap();
1341+
let user = user_name.to_cstring(vm)?;
13421342
let gid =
13431343
gid.ok_or_else(|| vm.new_errno_error(1, "Operation not permitted".to_string()))?;
13441344
unistd::initgroups(&user, gid).map_err(|err| err.into_pyexception(vm))

0 commit comments

Comments
 (0)