genode_c_api: safeguard session-policy parsing

Fix #4294
This commit is contained in:
Stefan Kalkowski 2021-10-11 11:24:28 +02:00 committed by Norman Feske
parent b7a379546e
commit 1d1379430a

View File

@ -453,6 +453,7 @@ genode_usb_session::genode_usb_session(::Root & root,
bool ::Root::_matches(Device & d, genode_usb_session & s)
{
try {
Session_policy const policy(s._label, _config.xml());
unsigned long vendor = policy.attribute_value<unsigned long>("vendor_id", 0);
@ -467,6 +468,7 @@ bool ::Root::_matches(Device & d, genode_usb_session & s)
return (vendor == d.vendor) && (product == d.product);
if (cla)
return (cla == d.cla) && (d.label() == s._label.last_element());
} catch(Session_policy::No_policy_defined) {}
return false;
}