[Keyboard] Cannon Keys Satisfaction75: Fix buffer sizes for sprintfs. (#6954)
sprintf always adds a NULL terminator at the end of the buffer it works on. A few places made just enough space for the resulting string, but not the terminator. So this just adds one to the buffer size to make room for it.master
parent
6bed239486
commit
2c51d14223
|
@ -91,8 +91,8 @@ void draw_default(){
|
||||||
if (hour == 0){
|
if (hour == 0){
|
||||||
hour = 12;
|
hour = 12;
|
||||||
}
|
}
|
||||||
char hour_str[2] = "";
|
char hour_str[3] = "";
|
||||||
char min_str[2] = "";
|
char min_str[3] = "";
|
||||||
|
|
||||||
sprintf(hour_str, "%02d", hour);
|
sprintf(hour_str, "%02d", hour);
|
||||||
sprintf(min_str, "%02d", minute);
|
sprintf(min_str, "%02d", minute);
|
||||||
|
@ -199,11 +199,11 @@ void draw_clock(){
|
||||||
if (hour == 0){
|
if (hour == 0){
|
||||||
hour = 12;
|
hour = 12;
|
||||||
}
|
}
|
||||||
char hour_str[2] = "";
|
char hour_str[3] = "";
|
||||||
char min_str[2] = "";
|
char min_str[3] = "";
|
||||||
char year_str[4] = "";
|
char year_str[5] = "";
|
||||||
char month_str[2] = "";
|
char month_str[3] = "";
|
||||||
char day_str[2] = "";
|
char day_str[3] = "";
|
||||||
|
|
||||||
sprintf(hour_str, "%02d", hour);
|
sprintf(hour_str, "%02d", hour);
|
||||||
sprintf(min_str, "%02d", minute);
|
sprintf(min_str, "%02d", minute);
|
||||||
|
|
Loading…
Reference in New Issue