mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
4e769022df
commit
1d165bb43d
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user