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:
@@ -116,8 +116,7 @@ static int network_init(const char *name, int protocol)
|
||||
struct ifreq ifr;
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
strncpy(ifr.ifr_name, name, strlen(name));
|
||||
|
||||
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", name);
|
||||
if (ioctl(sockfd, SIOCGIFINDEX, &ifr) == -1) {
|
||||
perror("Unable to get interface index");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user