From 62d5cc0db6d0e0b5a91dffda89ab33f5cc691fc0 Mon Sep 17 00:00:00 2001 From: Fabian Freyer Date: Wed, 2 Jan 2019 17:23:25 +0100 Subject: [PATCH] python: don't create RunningJails with invalid JID --- bindings/python/src/running.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bindings/python/src/running.rs b/bindings/python/src/running.rs index 596993e1f..6a78e11b3 100644 --- a/bindings/python/src/running.rs +++ b/bindings/python/src/running.rs @@ -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, });