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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <cc91f6bbe4e8536a1749268683265854dd19deed.1447773299.git.stillcompiling@gmail.com>
Date:	Tue, 17 Nov 2015 07:24:25 -0800
From:	Joshua Clayton <stillcompiling@...il.com>
To:	Mark Brown <broonie@...nel.org>
Cc:	Jonathan Corbet <corbet@....net>,
	Adrian Remonda <adrianremonda@...il.com>,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-spi@...r.kernel.org,
	Joshua Clayton <stillcompiling@...il.com>
Subject: [PATCH 5/8] Documentation/spi/spidev_test.c: check error

Check the result of sscanf to verify a result was found.
report and error and abort if pattern was not found.

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>
---
 Documentation/spi/spidev_test.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c
index 273f667..2ff5fe8 100644
--- a/Documentation/spi/spidev_test.c
+++ b/Documentation/spi/spidev_test.c
@@ -85,13 +85,17 @@ static void hex_dump(const void *src, size_t length, size_t line_size, char *pre
 static int unescape(char *_dst, char *_src, size_t len)
 {
 	int ret = 0;
+	int match;
 	char *src = _src;
 	char *dst = _dst;
 	unsigned int ch;
 
 	while (*src) {
 		if (*src == '\\' && *(src+1) == 'x') {
-			sscanf(src + 2, "%2x", &ch);
+			match = sscanf(src + 2, "%2x", &ch);
+			if (!match)
+				pabort("malformed input string");
+
 			src += 4;
 			*dst++ = (unsigned char)ch;
 		} else {
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ