]> git.ipfire.org Git - thirdparty/openvpn.git/commit
re-implement argv_printf_*()
authorHeiko Hund <heiko.hund@sophos.com>
Thu, 6 Feb 2020 13:21:00 +0000 (14:21 +0100)
committerDavid Sommerseth <davids@openvpn.net>
Thu, 20 Feb 2020 15:38:58 +0000 (16:38 +0100)
commit4ed7bf7f94a8cecbc2430d8025a2b8a46f94e429
treed5bf5610ebe708666f2d2c94fca1dc7c68d698e4
parent5bb71ab599a6c382b6bdc9e9cb449d11d64353b8
re-implement argv_printf_*()

The previous implementation had the problem that it was not fully
compatible with printf() and could only detect % format directives
following a space character (0x20).

It modifies the format string and inserts marks to separate groups
before passing it to the regular printf in libc. The marks are
later used to separate the output string into individual command
line arguments.

The choice of 0x1D as the argument delimiter is based on the
assumption that no "regular" string passed to argv_printf_*() will
ever have to contain that byte (and the fact that it actually is
the ASCII "group separator" control character, which fits its
purpose).

This commit has been updated by David Sommerseth based on Arne
Schwabe and his own feedback on the mailing list.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20200206132103.15977-2-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19380.html
src/openvpn/argv.c
src/openvpn/argv.h
src/openvpn/route.c
src/openvpn/tun.c
tests/unit_tests/openvpn/test_argv.c