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
+2 -1
View File
@@ -120,7 +120,8 @@ static int ethernet_bind(struct sockaddr *eth_addr, const char *interface_name)
/* Clear the memory before copying */
memset(eth_addr->sa_data, '\0', sizeof(eth_addr->sa_data));
/* Strcpy the interface name into the address */
strncpy(eth_addr->sa_data, interface_name, sizeof(eth_addr->sa_data) - 1);
snprintf(
eth_addr->sa_data, sizeof(eth_addr->sa_data), "%s", interface_name);
fprintf(stderr, "ethernet: binding \"%s\"\n", eth_addr->sa_data);
/* Attempt to bind the socket to the interface */
if (bind(sock_fd, eth_addr, sizeof(struct sockaddr)) != 0) {