minissdpd/getifaddr.c: fix strncpy() call

This commit is contained in:
Thomas Bernard 2015-07-16 17:15:36 +02:00
parent d02b1d4ec3
commit 07cc6215b5
1 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $Id: getifaddr.c,v 1.23 2014/05/06 14:40:53 nanard Exp $ */
/* $Id: getifaddr.c,v 1.24 2015/07/09 12:27:26 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2014 Thomas Bernard
@ -47,6 +47,7 @@ getifaddr(const char * ifname, char * buf, int len,
return -1;
}
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
ifr.ifr_name[IFNAMSIZ-1] = '\0';
if(ioctl(s, SIOCGIFFLAGS, &ifr, &ifrlen) < 0)
{
syslog(LOG_DEBUG, "ioctl(s, SIOCGIFFLAGS, ...): %m");