Replace most instances of sprintf() with snprintf()

This commit is contained in:
Adam Honse
2023-03-02 00:14:17 -06:00
parent c02d401b1d
commit ff8ac680ad
14 changed files with 36 additions and 36 deletions

View File

@@ -71,7 +71,7 @@ void RGBController_SRGBmodsPico::SetupZones()
for(unsigned int channel_idx = 0; channel_idx < SRGBMODS_PICO_NUM_CHANNELS; channel_idx++)
{
char ch_idx_string[2];
sprintf(ch_idx_string, "%d", channel_idx + 1);
snprintf(ch_idx_string, 2, "%d", channel_idx + 1);
zones[channel_idx].name = "Channel ";
zones[channel_idx].name.append(ch_idx_string);
@@ -94,7 +94,7 @@ void RGBController_SRGBmodsPico::SetupZones()
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
char led_idx_string[4];
sprintf(led_idx_string, "%d", led_ch_idx + 1);
snprintf(led_idx_string, 4, "%d", led_ch_idx + 1);
led new_led;
new_led.name = "LED ";
@@ -149,4 +149,4 @@ void RGBController_SRGBmodsPico::UpdateSingleLED(int led)
void RGBController_SRGBmodsPico::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
}