Commit 88042616 authored by Dong Anyuan's avatar Dong Anyuan

Fix Coverity Scan CID 140733 (Calling strncpy with a maximum size argument of...

Fix Coverity Scan CID 140733 (Calling strncpy with a maximum size argument of 16 bytes on destination array ifr.ifr_ifrn.ifrn_name of size 16 bytes might leave the destination string unterminated.)
parent 8fe94b2f
...@@ -81,7 +81,7 @@ static int tun_alloc(char *dev) { ...@@ -81,7 +81,7 @@ static int tun_alloc(char *dev) {
ifr.ifr_flags = IFF_TUN | IFF_NO_PI; ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
if( *dev ) if( *dev )
strncpy(ifr.ifr_name, dev, IFNAMSIZ); strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)-1);
if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) { if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) {
close(fd); close(fd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment