fixed call to strncpy in network interface determination code which leaves unterminated string if strlen(ifptr->if_name)==16

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8427 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-06-14 08:51:55 +00:00
parent 4e769022df
commit 1d165bb43d

View File

@ -174,7 +174,7 @@ bool getLocalInterfaces_ipv4(struct in_addr &/*routeAddr*/, std::list<struct in_
for(; ifptr->if_index != 0; ++ifptr)
{
//copy in the interface name to look up address of
strncpy(ifreq.ifr_name, ifptr->if_name, IF_NAMESIZE);
strncpy(ifreq.ifr_name, ifptr->if_name, IF_NAMESIZE-1);// the -1 is here to ensure that there's enough room left to place a \0 termination byte
if(ioctl(sock, SIOCGIFADDR, &ifreq) != 0)
{