From 1905e29401acd301f62f1e49950874368a5172e7 Mon Sep 17 00:00:00 2001 From: Sam Stenvall Date: Wed, 7 Aug 2024 09:32:34 +0300 Subject: [PATCH] Use strlen instead of pointer length Since we no longer use stack allocated char[] it's important which one we use --- src/api/variables.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/variables.c b/src/api/variables.c index 9ef57436b2..05ccf1fa44 100644 --- a/src/api/variables.c +++ b/src/api/variables.c @@ -277,7 +277,8 @@ int get_json_state(char *buf, int len, char *sbuf, int slen) { funs(off, sbuf, slen - 1); if (off > 0) strlcatf(buf, len, ptr, ","); - ptr += escape_json_string(buf + ptr, len - ptr, sbuf, slen); + ptr += escape_json_string(buf + ptr, len - ptr, sbuf, + strlen(sbuf)); } strlcatf(buf, len, ptr, "]"); // LOG("func_str -> %s", buf);