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>] [day] [month] [year] [list]
Message-ID: <1648175583-2045-1-git-send-email-baihaowen@meizu.com>
Date:   Fri, 25 Mar 2022 10:33:03 +0800
From:   Haowen Bai <baihaowen@...zu.com>
To:     <haren@...ibm.com>
CC:     <linux-kernel@...r.kernel.org>, Haowen Bai <baihaowen@...zu.com>
Subject: [PATCH] lib: 842: Fix pointer dereferenced before checking

The pointer t is dereferencing comp_ops[c] before c is being
 bound checked. Fix this by assigning comp_ops[c] to t only if
c is safy, otherwise just NULL.

Signed-off-by: Haowen Bai <baihaowen@...zu.com>
---
 lib/842/842_compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/842/842_compress.c b/lib/842/842_compress.c
index c02baa4..6ff6973 100644
--- a/lib/842/842_compress.c
+++ b/lib/842/842_compress.c
@@ -222,7 +222,7 @@ static int add_bits(struct sw842_param *p, u64 d, u8 n)
 static int add_template(struct sw842_param *p, u8 c)
 {
 	int ret, i, b = 0;
-	u8 *t = comp_ops[c];
+	u8 *t = c < OPS_MAX ? comp_ops[c] : NULL;
 	bool inv = false;
 
 	if (c >= OPS_MAX)
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ