From 9b56baca8f210dc5d3c708b4b1627b276a5efd54 Mon Sep 17 00:00:00 2001 From: Yichen Gu Date: Wed, 13 Oct 2021 15:50:15 +0100 Subject: [PATCH] ss: static policy generator: fix filepath detection --- lib/secure-streams/policy-json.c | 3 ++- lib/secure-streams/private-lib-secure-streams.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/secure-streams/policy-json.c b/lib/secure-streams/policy-json.c index 3427ae6d4..7e5656f67 100644 --- a/lib/secure-streams/policy-json.c +++ b/lib/secure-streams/policy-json.c @@ -1246,10 +1246,11 @@ lws_ss_policy_parse(struct lws_context *context, const uint8_t *buf, size_t len) int m; #if !defined(LWS_PLAT_FREERTOS) && !defined(LWS_PLAT_OPTEE) - if (args->jctx.line < 2 && buf[0] != '{') + if (args->jctx.line < 2 && buf[0] != '{' && !args->parse_data) return lws_ss_policy_parse_file(context, (const char *)buf); #endif + args->parse_data = 1; m = lejp_parse(&args->jctx, buf, (int)len); if (m == LEJP_CONTINUE || m >= 0) return m; diff --git a/lib/secure-streams/private-lib-secure-streams.h b/lib/secure-streams/private-lib-secure-streams.h index ebfa7efa0..70de42f0e 100644 --- a/lib/secure-streams/private-lib-secure-streams.h +++ b/lib/secure-streams/private-lib-secure-streams.h @@ -401,6 +401,8 @@ struct policy_cb_args { int count; char pending_respmap; + + uint8_t parse_data:1; }; #if defined(LWS_WITH_SYS_SMD)