From 81bc2aea53a6dbca8b1b3f32a042afb3db5640d1 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 11 Aug 2017 12:56:30 +0200 Subject: tun_new(): Fix array overflow in FreeBSD related code Change-Id: I096e3b614e82e402886163274cfcf9355bd57580 --- lib/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tun.c b/lib/tun.c index f6869ef..c4b7d10 100644 --- a/lib/tun.c +++ b/lib/tun.c @@ -784,7 +784,7 @@ int tun_new(struct tun_t **tun) } snprintf((*tun)->devname, sizeof((*tun)->devname), "tun%d", devnum); - (*tun)->devname[sizeof((*tun)->devname)] = 0; + (*tun)->devname[sizeof((*tun)->devname)-1] = 0; /* The tun device we found might have "old" IP addresses allocated */ /* We need to delete those. This problem is not present on Linux */ -- cgit v1.2.3