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: <20240218204203.7564-1-maks.mishinFZ@gmail.com>
Date: Sun, 18 Feb 2024 23:42:03 +0300
From: Maks Mishin <maks.mishinfz@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: Maks Mishin <maks.mishinFZ@...il.com>,
	netdev@...r.kernel.org
Subject: [PATCH] ipmaddr: Add check for result of sscanf

Added comparison of result sscanf with 2 to avoid
potential troubles with args of sscanf.
Found by RASU JSC.

Signed-off-by: Maks Mishin <maks.mishinFZ@...il.com>
---
 ip/ipmaddr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c
index 2418b303..00e91004 100644
--- a/ip/ipmaddr.c
+++ b/ip/ipmaddr.c
@@ -148,7 +148,9 @@ static void read_igmp(struct ma_info **result_p)
 		if (buf[0] != '\t') {
 			size_t len;
 
-			sscanf(buf, "%d%s", &m.index, m.name);
+			if (sscanf(buf, "%d%s", &m.index, m.name) != 2)
+				return;
+
 			len = strlen(m.name);
 			if (m.name[len - 1] == ':')
 				m.name[len - 1] = '\0';
-- 
2.30.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ