]> git.ipfire.org Git - thirdparty/openvpn.git/commit
tun.c: fix 'use after free' error
authorLev Stipakov <lev@openvpn.net>
Thu, 12 Mar 2020 06:08:29 +0000 (08:08 +0200)
committerGert Doering <gert@greenie.muc.de>
Sat, 14 Mar 2020 08:45:59 +0000 (09:45 +0100)
commit5d28b47c51f4fcef631f9dae83f9cbc7120c6812
treecb288318a9dbd1bcf6aa39d5b39b2b7c2bfa7d6c
parent04f4b4feec2790b620419bdc4fa2c7ae4f2451bd
tun.c: fix 'use after free' error

Commit 509c45f has factored out code blocks of open_tun()
into separate functions and introduced "use after free" bug:

Variable "device_guid" is allocated inside tun_open_device()
function and used outside of it. Allocation happens with
local gc_arena, which is freed at the end of tun_open_device(),
making futher access to "device_guid" invalid.

Fix by ensuring that gc_arena scope covers all access to "device_guid".

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Simon Rozman <simon@rozman.si>
Message-Id: <20200312060829.19468-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19547.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/tun.c