aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYichen Gu <guyiche@amazon.com>2021-10-13 15:50:15 +0100
committerAndy Green <andy@warmcat.com>2021-10-13 15:55:56 +0100
commit9b56baca8f210dc5d3c708b4b1627b276a5efd54 (patch)
treeebdb94a0f3fd9f1167323aec447c57e1adea49a4 /lib
parent61c2e3291f64b2a0fe5285b4bd6418a8ef92cb0d (diff)
downloadlibwebsockets-9b56baca8f210dc5d3c708b4b1627b276a5efd54.tar.gz
ss: static policy generator: fix filepath detection
Diffstat (limited to 'lib')
-rw-r--r--lib/secure-streams/policy-json.c3
-rw-r--r--lib/secure-streams/private-lib-secure-streams.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/secure-streams/policy-json.c b/lib/secure-streams/policy-json.c
index 3427ae6d..7e5656f6 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 ebfa7efa..70de42f0 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)