Bugfix/win32 build warnings (#936)

* Changed win32 port of localtime to use secure OS API functions when compiled with MSVC

* Changed all the sprintf to use snprintf instead in BSC tests to ensure null string endings.
This commit is contained in:
Steve Karg
2025-03-03 10:32:28 -06:00
committed by GitHub
parent b0a26cf2cd
commit 7e725ce028
21 changed files with 317 additions and 275 deletions
+4 -4
View File
@@ -467,16 +467,16 @@ bool bacnet_discover_property_name(
device_id, object_type, object_instance, object_property, &value);
if (status && value.tag == BACNET_APPLICATION_TAG_CHARACTER_STRING) {
if (characterstring_valid(&value.type.Character_String)) {
strncpy(
buffer, characterstring_value(&value.type.Character_String),
buffer_len - 1);
snprintf(
buffer, buffer_len, "%s",
characterstring_value(&value.type.Character_String));
} else {
status = false;
}
}
}
if (!status) {
strncpy(buffer, default_string, buffer_len);
snprintf(buffer, buffer_len, "%s", default_string);
}
return status;