lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230819205448.428253-1-pctammela@mojatatu.com>
Date: Sat, 19 Aug 2023 17:54:48 -0300
From: Pedro Tammela <pctammela@...atatu.com>
To: netdev@...r.kernel.org
Cc: stephen@...workplumber.org,
	dsahern@...il.com,
	Pedro Tammela <pctammela@...atatu.com>
Subject: [PATCH iproute2-next] utils: fix get_integer() logic

After 3a463c15, get_integer() doesn't return the converted value and
always writes 0 in 'val' in case of success.
Fix the logic so it writes the converted value in 'val'.

Fixes: 3a463c15 ("Add get_long utility and adapt get_integer accordingly"
Signed-off-by: Pedro Tammela <pctammela@...atatu.com>
---
 lib/utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/utils.c b/lib/utils.c
index efa01668..99ba7a23 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -142,7 +142,8 @@ int get_integer(int *val, const char *arg, int base)
 {
 	long res;
 
-	res = get_long(NULL, arg, base);
+	if (get_long(&res, arg, base) < 0)
+		return -1;
 
 	/* Outside range of int */
 	if (res < INT_MIN || res > INT_MAX)
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ