Fix compiler warnings.
[oweals/tinc.git] / src / linux / device.c
index 2c40ead099b5a24f4ee86e8b4037b40544821113..0abafa9dc2aa5ef6d1c592e854fde9fc3eec81c0 100644 (file)
@@ -103,10 +103,12 @@ static bool setup_device(void) {
 
        if(iface) {
                strncpy(ifr.ifr_name, iface, IFNAMSIZ);
+               ifr.ifr_name[IFNAMSIZ - 1] = 0;
        }
 
        if(!ioctl(device_fd, TUNSETIFF, &ifr)) {
                strncpy(ifrname, ifr.ifr_name, IFNAMSIZ);
+               ifrname[IFNAMSIZ - 1] = 0;
                free(iface);
                iface = xstrdup(ifrname);
        } else {