From 97453a17f9abd09a57eb0db72d371cb2c212fc2e Mon Sep 17 00:00:00 2001 From: daleylin <76830418+daleylin@users.noreply.github.com> Date: Sun, 24 Jan 2021 00:03:49 +0800 Subject: [PATCH] bugfix: fix string length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、此处字符串长度最大为 sizeof(str_value)-1,实际比这个更小,错误的长度导致 gx_prompt_text_set_ext(prompt,&string)函数报错 --- samples/demo_guix_thermostat/demo_guix_thermostat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/demo_guix_thermostat/demo_guix_thermostat.c b/samples/demo_guix_thermostat/demo_guix_thermostat.c index 298e851f..afb39d11 100644 --- a/samples/demo_guix_thermostat/demo_guix_thermostat.c +++ b/samples/demo_guix_thermostat/demo_guix_thermostat.c @@ -122,7 +122,7 @@ GX_STRING string; gx_utility_ltoa(i_temperature, str_value, 10); string.gx_string_ptr = str_value; - string.gx_string_length = sizeof(str_value) - 1; + string.gx_string_length = GX_STRLEN(str_value); gx_prompt_text_set_ext(prompt, &string); }