Refactored all the sprintf to use snprintf instead. (#628)

This commit is contained in:
Steve Karg
2024-04-27 12:41:45 -05:00
committed by GitHub
parent 70c54817fd
commit bb276e2431
46 changed files with 308 additions and 272 deletions
+3 -3
View File
@@ -66,11 +66,11 @@ uint32_t Analog_Input_Index_To_Instance(unsigned index)
char *Analog_Input_Name(uint32_t object_instance)
{
static char text_string[16] = ""; /* okay for single thread */
static char text[16] = ""; /* okay for single thread */
if (object_instance < MAX_ANALOG_INPUTS) {
sprintf(text_string, "AI-%lu", (unsigned long)object_instance);
return text_string;
snprintf(text, sizeof(text), "AI-%lu", (unsigned long)object_instance);
return text;
}
return NULL;