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
+4 -3
View File
@@ -131,12 +131,13 @@ unsigned Access_User_Instance_To_Index(uint32_t object_instance)
bool Access_User_Object_Name(
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
{
static char text_string[32] = ""; /* okay for single thread */
static char text[32] = ""; /* okay for single thread */
bool status = false;
if (object_instance < MAX_ACCESS_USERS) {
sprintf(text_string, "ACCESS USER %lu", (unsigned long)object_instance);
status = characterstring_init_ansi(object_name, text_string);
snprintf(text, sizeof(text), "ACCESS USER %lu",
(unsigned long)object_instance);
status = characterstring_init_ansi(object_name, text);
}
return status;