9
0
Fork 0

tun_new(): Fix array overflow in FreeBSD related code

Change-Id: I096e3b614e82e402886163274cfcf9355bd57580
This commit is contained in:
Harald Welte 2017-08-11 12:56:30 +02:00
parent ab6d189f8f
commit 81bc2aea53
1 changed files with 1 additions and 1 deletions

View File

@ -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 */