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]
Date:   Mon, 13 Dec 2021 15:12:17 +0800
From:   Xiaoke Wang <xkernel.wang@...mail.com>
To:     dhowells@...hat.com, marc.dionne@...istor.com
Cc:     linux-afs@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Xiaoke Wang <xkernel.wang@...mail.com>
Subject: [PATCH] afs: fix a potential dead cycle and add a check for the return value of memchr()

Note: this email is using full name
We should make the address pointed by p plus 1, otherwise, it will fall
into a dead circle. And memchr() can return NULL if the target character
is not found, so it is better to check the return value of it.

Signed-off-by: Xiaoke Wang <xkernel.wang@...mail.com>
---
 fs/afs/addr_list.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/afs/addr_list.c b/fs/afs/addr_list.c
index de1ae0b..83e6171 100644
--- a/fs/afs/addr_list.c
+++ b/fs/afs/addr_list.c
@@ -90,8 +90,10 @@ struct afs_vlserver_list *afs_parse_text_addrs(struct afs_net *net,
 			problem = "nul";
 			goto inval;
 		}
-		if (*p == delim)
+		if (*p == delim) {
+			p++;
 			continue;
+		}
 		nr++;
 		if (*p == '[') {
 			p++;
@@ -146,6 +148,10 @@ struct afs_vlserver_list *afs_parse_text_addrs(struct afs_net *net,
 		if (*p == '[') {
 			p++;
 			q = memchr(p, ']', end - p);
+			if (!q) {
+				problem = "brace2";
+				goto bad_address;
+			}
 		} else {
 			for (q = p; q < end; q++)
 				if (*q == '+' || *q == delim)
-- 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ