From: Domagoj Pensa Message-ID: <20201215171600.25534-1-domagoj@...2540...> Date: Tue, 15 Dec 2020 18:16:00 +0100 MIME-Version: 1.0 Subject: [Openvpn-devel] [PATCH] Fix too early argv freeing when registering DNS List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf8" Content-Transfer-Encoding: quoted-printable To: openvpn-devel@lists.sourceforge.net Cc: Domagoj Pensa When registering DNS on Windows, argv is freed after being used in first ipconfig command (/flushdns). Then same argv is used uninitialized in next ipconfig command (/registerdns) causing heap exception and subprocess crash. As a consequence second command is never executed and locked netcmd semaphore is not cleanly released. Removing argv freeing between ipconfig calls solves the problem. This issue was introduced in commit 870e240 (argv: do fewer memory re-allocations). After a quick glance at commit no similar problem was spotted in rest of the argv related changes. Signed-off-by: Domagoj Pensa --- src/openvpn/tun.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 400a50ca..2b227bb6 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -5235,7 +5235,6 @@ ipconfig_register_dns(const struct env_set *es) WIN_IPCONFIG_PATH_SUFFIX); argv_msg(D_TUNTAP_INFO, &argv); openvpn_execve_check(&argv, es, 0, err); - argv_free(&argv); =20 argv_printf(&argv, "%s%s /registerdns", get_win_sys_path(), --=20 2.29.2