wbokslag has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-tetra/+/28591 )
Change subject: ensure zero termination of tun device name ......................................................................
ensure zero termination of tun device name
Change-Id: I4b783c6b98ddfb30a4ca4532ef8cffa8e5f3a12f --- M src/tuntap.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/91/28591/1
diff --git a/src/tuntap.c b/src/tuntap.c index 8109067..6ae16c7 100644 --- a/src/tuntap.c +++ b/src/tuntap.c @@ -29,7 +29,7 @@ */ 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);