1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

Fix off-by-one error in lv_label_set_text_fmt

This commit is contained in:
Themba Dube 2019-08-18 16:00:57 -04:00
parent d5d8eb5afd
commit 7ea67301d7

View File

@ -241,7 +241,7 @@ void lv_label_set_text_fmt(lv_obj_t * label, const char * fmt, ...)
if(ext->text == NULL) return; if(ext->text == NULL) return;
ext->text[len-1] = 0; /* Ensure NULL termination */ ext->text[len-1] = 0; /* Ensure NULL termination */
lv_vsnprintf(ext->text, len, fmt, ap2); lv_vsnprintf(ext->text, len+1, fmt, ap2);
va_end(ap2); va_end(ap2);
ext->static_txt = 0; /*Now the text is dynamically allocated*/ ext->static_txt = 0; /*Now the text is dynamically allocated*/