fix(usperspace): webserver must not fail with input that exceeds the expected ranges

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
Leonardo Di Donato 2019-08-01 19:10:02 +00:00 committed by Lorenzo Fontana
parent c9cd6eebf7
commit 8c62ec5472

View File

@ -44,7 +44,8 @@ bool k8s_audit_handler::accept_data(falco_engine *engine,
std::list<json_event> jevts; std::list<json_event> jevts;
json j; json j;
try { try
{
j = json::parse(data); j = json::parse(data);
} }
catch(json::parse_error &e) catch(json::parse_error &e)
@ -52,6 +53,11 @@ bool k8s_audit_handler::accept_data(falco_engine *engine,
errstr = string("Could not parse data: ") + e.what(); errstr = string("Could not parse data: ") + e.what();
return false; return false;
} }
catch(json::out_of_range &e)
{
errstr = string("Could not parse data: ") + e.what();
return false;
}
bool ok; bool ok;
try try