Skip to content
Snippets Groups Projects
Commit 88042616 authored by DONG Anyuan's avatar DONG Anyuan
Browse files

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
No related branches found
No related tags found
4 merge requests!650Release v1.1.0 Candidate,!620Resolve "Coverity Scan Fix (Week25)",!617Develop: Integration 2019 Week 25,!588Develop nr merge
...@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment