]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Add ASSERT to afunix code that dev_node is always set up the way we expect
authorArne Schwabe <arne@rfc2549.org>
Tue, 28 Oct 2025 11:59:47 +0000 (12:59 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 28 Oct 2025 12:05:44 +0000 (13:05 +0100)
The calling code only calls tun_afunix_exec_child if is_tun_afunix is true,
which checks that the path is having unix: as prefix.

But since adding an ASSERT here to ensure that it is really the case
does not cost us anything, just add the ASSERT.

Reported-By: Joshua Rogers <contact@joshua.hu>
Found-By: Zeropath
Change-Id: Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1320
Message-Id: <20251028115953.22487-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33934.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/tun_afunix.c

index 124db6d98106168a4a7db1ce975571e99695d0b6..42bcd0d4450918f42b4825e3989ecfc076c6b3f4 100644 (file)
@@ -53,6 +53,8 @@ tun_afunix_exec_child(const char *dev_node, struct tuntap *tt, struct env_set *e
     const char *msgprefix = "ERROR: failure executing process for tun:";
     struct argv argv = argv_new();
 
+    /* we should always called with a proper unix: dev node string */
+    ASSERT(dev_node && strncmp(dev_node, "unix:", strlen("unix:")) == 0);
     /* since we know that dev-node starts with unix: we can just skip that
      * to get the program name */
     const char *program = dev_node + strlen("unix:");