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
+3 -2
View File
@@ -422,8 +422,9 @@ static bool PrettyPrintPropertyValue(
/* eg, property == PROP_LOCAL_DATE
* VTS needs (3-Aug-2011,4) or (8/3/11,4), so we'll use the
* clearer, international form. */
strncpy(short_month, bactext_month_name(value->type.Date.month), 3);
short_month[3] = 0;
snprintf(
short_month, sizeof(short_month), "%s",
bactext_month_name(value->type.Date.month));
fprintf(
stream, "(%u-%3s-%u, %u)", (unsigned)value->type.Date.day,
short_month, (unsigned)value->type.Date.year,