aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tun.c
diff options
context:
space:
mode:
authorEmmanuel Bretelle <chantra@debuntu.org>2010-09-07 20:22:36 +0200
committerHarald Welte <laforge@gnumonks.org>2010-10-20 11:04:51 +0200
commit87490d7fa9052ca1fe1b67ba01c46611f9925ded (patch)
tree63d4896ad6aac6d2592b91631c142f9540713e64 /lib/tun.c
parent4e56c83be220d666a2821bfc4d88dbcc951d4f42 (diff)
IFNAMSIZ includes terminating 0
http://www.delorie.com/gnu/docs/glibc/libc_308.html thus reverting devname to IFNAMSIZ and making sure (*tun)->devname[IFNAMSIZ-1] = 0; Signed-off-by: Emmanuel Bretelle <chantra@debuntu.org>
Diffstat (limited to 'lib/tun.c')
-rw-r--r--lib/tun.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/tun.c b/lib/tun.c
index 0f39994..03d057c 100644
--- a/lib/tun.c
+++ b/lib/tun.c
@@ -688,7 +688,7 @@ int tun_new(struct tun_t **tun)
}
strncpy((*tun)->devname, ifr.ifr_name, IFNAMSIZ);
- (*tun)->devname[IFNAMSIZ] = 0;
+ (*tun)->devname[IFNAMSIZ-1] = 0;
ioctl((*tun)->fd, TUNSETNOCSUM, 1); /* Disable checksums */
return 0;