mirror of https://gerrit.osmocom.org/osmo-tetra
ensure zero termination of tun device name
Change-Id: I4b783c6b98ddfb30a4ca4532ef8cffa8e5f3a12f
This commit is contained in:
parent
472260475b
commit
bdc9b28693
|
@ -29,7 +29,7 @@ int tun_alloc(char *dev)
|
|||
*/
|
||||
ifr.ifr_flags = IFF_TUN|IFF_NO_PI;
|
||||
if( *dev )
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
snprintf(ifr.ifr_name, IFNAMSIZ, "%s", dev);
|
||||
|
||||
if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){
|
||||
close(fd);
|
||||
|
|
Loading…
Reference in New Issue