Fix char array lengths

This commit is contained in:
Nick Winans 2022-09-22 00:32:56 -05:00
parent 79db205ef2
commit 3ec52c3f91
2 changed files with 4 additions and 4 deletions

View file

@ -27,7 +27,7 @@ struct battery_status_state {
};
static void set_battery_symbol(lv_obj_t *label, struct battery_status_state state) {
char text[3] = {};
char text[8] = {};
uint8_t level = state.level;

View file

@ -24,15 +24,15 @@ struct layer_status_state {
static void set_layer_symbol(lv_obj_t *label, struct layer_status_state state) {
if (state.label == NULL) {
char text[6] = {};
char text[7] = {};
sprintf(text, LV_SYMBOL_KEYBOARD " %i", state.index);
lv_label_set_text(label, text);
} else {
char text[12] = {};
char text[13] = {};
snprintf(text, 12, LV_SYMBOL_KEYBOARD " %s", state.label);
snprintf(text, sizeof(text), LV_SYMBOL_KEYBOARD " %s", state.label);
lv_label_set_text(label, text);
}