Fixed possibly non-null terminated string in spgw.

master
Pedro Alvarez 7 years ago
parent fd7ba9852b
commit 05576df327

@ -175,7 +175,9 @@ spgw::init_sgi_if(spgw_args_t *args)
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
strncpy(ifr.ifr_ifrn.ifrn_name, dev, IFNAMSIZ);
strncpy(ifr.ifr_ifrn.ifrn_name, dev, IFNAMSIZ-1);
ifr.ifr_ifrn.ifrn_name[IFNAMSIZ-1]='\0';
if(ioctl(m_sgi_if, TUNSETIFF, &ifr) < 0)
{
m_spgw_log->error("Failed to set TUN device name: %s\n", strerror(errno));

Loading…
Cancel
Save