Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH 1/2] smb: client: allow parsing zero-length AV pairs
@ 2025-07-25  3:04 Paulo Alcantara
  2025-07-25  3:04 ` [PATCH 2/2] smb: client: fix session setup against servers that require SPN Paulo Alcantara
  2025-07-25  3:52 ` [PATCH 1/2] smb: client: allow parsing zero-length AV pairs Steve French
  0 siblings, 2 replies; 3+ messages in thread
From: Paulo Alcantara @ 2025-07-25  3:04 UTC (permalink / raw)
  To: smfrench; +Cc: linux-cifs, David Howells, Paulo Alcantara (Red Hat)

Zero-length AV pairs should be considered as valid target infos.
Don't skip the next AV pairs that follow them.

Cc: linux-cifs@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>
Fixes: 0e8ae9b953bc ("smb: client: parse av pair type 4 in CHALLENGE_MESSAGE")
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
---
 fs/smb/client/cifsencrypt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/smb/client/cifsencrypt.c b/fs/smb/client/cifsencrypt.c
index 35892df7335c..6be850d2a346 100644
--- a/fs/smb/client/cifsencrypt.c
+++ b/fs/smb/client/cifsencrypt.c
@@ -343,7 +343,7 @@ static struct ntlmssp2_name *find_next_av(struct cifs_ses *ses,
 	len = AV_LEN(av);
 	if (AV_TYPE(av) == NTLMSSP_AV_EOL)
 		return NULL;
-	if (!len || (u8 *)av + sizeof(*av) + len > end)
+	if ((u8 *)av + sizeof(*av) + len > end)
 		return NULL;
 	return av;
 }
@@ -363,7 +363,7 @@ static int find_av_name(struct cifs_ses *ses, u16 type, char **name, u16 maxlen)
 
 	av_for_each_entry(ses, av) {
 		len = AV_LEN(av);
-		if (AV_TYPE(av) != type)
+		if (AV_TYPE(av) != type || !len)
 			continue;
 		if (!IS_ALIGNED(len, sizeof(__le16))) {
 			cifs_dbg(VFS | ONCE, "%s: bad length(%u) for type %u\n",
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-25  3:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-25  3:04 [PATCH 1/2] smb: client: allow parsing zero-length AV pairs Paulo Alcantara
2025-07-25  3:04 ` [PATCH 2/2] smb: client: fix session setup against servers that require SPN Paulo Alcantara
2025-07-25  3:52 ` [PATCH 1/2] smb: client: allow parsing zero-length AV pairs Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox