Refactored all the sprintf to use snprintf instead. (#628)
This commit is contained in:
@@ -464,16 +464,16 @@ static bool Binary_Value_Present_Value_Write(uint32_t object_instance,
|
||||
bool Binary_Value_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;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Binary_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
if (pObject->Object_Name == NULL) {
|
||||
sprintf(text_string, "BINARY INPUT %lu",
|
||||
snprintf(text, sizeof(text), "BINARY INPUT %lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, text_string);
|
||||
status = characterstring_init_ansi(object_name, text);
|
||||
} else {
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
|
||||
Reference in New Issue
Block a user