Fix text buffer overflow in sunrise_sunset_face (#22)

This commit is contained in:
PrimmR 2025-07-06 16:31:45 +01:00 committed by GitHub
parent 976fd3248b
commit b5a457cd19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -152,7 +152,7 @@ static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "RIS", "rI"); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "RIS", "rI");
sprintf(buf, "%2d", scratch_time.unit.day); sprintf(buf, "%2d", scratch_time.unit.day);
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf); watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
sprintf(buf, "%2d%02d%s", scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name); sprintf(buf, "%2d%02d%2s", scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
watch_display_text(WATCH_POSITION_BOTTOM, buf); watch_display_text(WATCH_POSITION_BOTTOM, buf);
return; return;
} else { } else {
@ -191,7 +191,7 @@ static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "SET", "SE"); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "SET", "SE");
sprintf(buf, "%2d", scratch_time.unit.day); sprintf(buf, "%2d", scratch_time.unit.day);
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf); watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
sprintf(buf, "%2d%02d%s", scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name); sprintf(buf, "%2d%02d%2s", scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
watch_display_text(WATCH_POSITION_BOTTOM, buf); watch_display_text(WATCH_POSITION_BOTTOM, buf);
return; return;
} else { } else {

View File

@ -72,7 +72,7 @@ void sunrise_sunset_face_resign(void *context);
}) })
typedef struct { typedef struct {
char name[2]; char name[3];
int16_t latitude; int16_t latitude;
int16_t longitude; int16_t longitude;
} long_lat_presets_t; } long_lat_presets_t;