From 8c62ec547234a4aa7db2b80891bd3a2cc7eb80cf Mon Sep 17 00:00:00 2001 From: Leonardo Di Donato Date: Thu, 1 Aug 2019 19:10:02 +0000 Subject: [PATCH] fix(usperspace): webserver must not fail with input that exceeds the expected ranges Signed-off-by: Leonardo Di Donato --- userspace/falco/webserver.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/userspace/falco/webserver.cpp b/userspace/falco/webserver.cpp index 466db200..1a6d14fa 100644 --- a/userspace/falco/webserver.cpp +++ b/userspace/falco/webserver.cpp @@ -44,10 +44,16 @@ bool k8s_audit_handler::accept_data(falco_engine *engine, std::list jevts; json j; - try { + try + { j = json::parse(data); } - catch (json::parse_error& e) + catch(json::parse_error &e) + { + errstr = string("Could not parse data: ") + e.what(); + return false; + } + catch(json::out_of_range &e) { errstr = string("Could not parse data: ") + e.what(); return false;