eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit ba1253df3b2b087e7210fb28cc90f3049a423d9b
parent ef956995b8a82101626a7d907156fa4ac4b4f2f6
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date:   Thu, 16 Jun 2022 02:02:17 +0200

netconfig: Fix address format validation

Drop the wrong negation in the error check.  Check that there are no extra
characters after prefix length suffix.  Reset errno 0 before the strtoul
call, as recommended by the manpage.

Diffstat:
Msrc/netconfig.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/netconfig.c b/src/netconfig.c @@ -515,6 +515,7 @@ static struct l_rtnl_address *netconfig_get_static6_address( { L_AUTO_FREE_VAR(char *, ip); char *p; + char *endp; struct l_rtnl_address *ret; uint32_t prefix_len = 128; @@ -530,8 +531,9 @@ static struct l_rtnl_address *netconfig_get_static6_address( if (*++p == '\0') goto no_prefix_len; - prefix_len = strtoul(p, NULL, 10); - if (!unlikely(errno == EINVAL || errno == ERANGE || + errno = 0; + prefix_len = strtoul(p, &endp, 10); + if (unlikely(*endp != '\0' || errno || !prefix_len || prefix_len > 128)) { l_error("netconfig: Invalid prefix '%s' provided in network" " configuration file", p);