mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 15:02:50 +02:00
libnet: avoid unterminated strings
Signed-off-by: MarkusVolk <f_l_k@t-online.de>
Origin commit data
------------------
Branch: ni/coolstream
Commit: 6a51539434
Author: Markus Volk <f_l_k@t-online.de>
Date: 2020-01-14 (Tue, 14 Jan 2020)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -102,7 +102,7 @@ void netGetIP(std::string &dev, std::string &ip, std::string &mask, std::string
|
||||
|
||||
|
||||
memset(&req,0,sizeof(req));
|
||||
strncpy(req.ifr_name, dev.c_str(), sizeof(req.ifr_name));
|
||||
strncpy(req.ifr_name, dev.c_str(), sizeof(req.ifr_name)-1);
|
||||
saddr = (struct sockaddr_in *) &req.ifr_addr;
|
||||
addr= (unsigned char*) &saddr->sin_addr.s_addr;
|
||||
|
||||
@@ -290,7 +290,7 @@ void netGetMacAddr(std::string &ifname, unsigned char *mac)
|
||||
return;
|
||||
|
||||
ifr.ifr_addr.sa_family = AF_INET;
|
||||
strncpy(ifr.ifr_name, ifname.c_str(), sizeof(ifr.ifr_name));
|
||||
strncpy(ifr.ifr_name, ifname.c_str(), sizeof(ifr.ifr_name)-1);
|
||||
|
||||
if(ioctl(fd, SIOCGIFHWADDR, &ifr) < 0)
|
||||
return;
|
||||
|
Reference in New Issue
Block a user