]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Print warnings/errors when numerical parameters cannot be parsed
authorArne Schwabe <arne@rfc2549.org>
Mon, 27 Jan 2025 12:25:31 +0000 (13:25 +0100)
committerGert Doering <gert@greenie.muc.de>
Mon, 27 Jan 2025 12:28:00 +0000 (13:28 +0100)
commit40518dc66d9d04e6ec7e04439d7a6bc7fd6ac20f
tree0b9e8218faa03cf190a602b54006fc42bb0887c1
parentd9af13e8c222cba41000202908663a6d1e2cd028
Print warnings/errors when numerical parameters cannot be parsed

Using the atoi method is a best effort method that parses as much of the
input string as possible as integer and ignores the rest or return 0
if the string cannot be parsed. This is lead to unexpected results.

Change the behaviour by printing a warning in these cases instead. When
parsing a configuration, these warnings will error out since the msglevel
is M_USAGE in this case. Example:

    ./src/openvpn/openvpn --resolv-retry 198jj
    Options error: Cannot parse argument '198jj' as non-negative integer

Reported-By: Anqi Chen <chen.anqi3@northeastern.edu>
Reported-By: Cristina Nita-Rotaru <c.nitarotaru@northeastern.edu>
Change-Id: Ie1e2eb54d516b3ae87c5ca56fe8edd77ee2be4de
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250127122531.13105-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30627.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/options.c
src/openvpn/options_util.c
src/openvpn/options_util.h