Skip to content

Commit

Permalink
python: don't create RunningJails with invalid JID
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianfreyer committed Jan 2, 2019
1 parent f674ae4 commit 62d5cc0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bindings/python/src/running.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ impl RunningJail {
let py_num: Result<&PyInt, PyDowncastError> = identifier.as_ref(obj.py()).try_into();
if let Ok(jid) = py_num {
let jid: i32 = jid.extract()?;
let inner = native::RunningJail::from_jid(jid)
.ok_or(exceptions::SystemError::py_err("No jail with that JID"))?;
return obj.init(|token| RunningJail {
inner: native::RunningJail::from_jid(jid),
inner,
dead: false,
token,
});
Expand Down

0 comments on commit 62d5cc0

Please sign in to comment.