Skip to content

Commit be77ab6

Browse files
pcacjrsmfrench
authored andcommitted
smb: client: allow parsing zero-length AV pairs
Zero-length AV pairs should be considered as valid target infos. Don't skip the next AV pairs that follow them. Cc: [email protected] Cc: David Howells <[email protected]> Fixes: 0e8ae9b ("smb: client: parse av pair type 4 in CHALLENGE_MESSAGE") Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 3edc68d commit be77ab6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/smb/client/cifsencrypt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static struct ntlmssp2_name *find_next_av(struct cifs_ses *ses,
343343
len = AV_LEN(av);
344344
if (AV_TYPE(av) == NTLMSSP_AV_EOL)
345345
return NULL;
346-
if (!len || (u8 *)av + sizeof(*av) + len > end)
346+
if ((u8 *)av + sizeof(*av) + len > end)
347347
return NULL;
348348
return av;
349349
}
@@ -363,7 +363,7 @@ static int find_av_name(struct cifs_ses *ses, u16 type, char **name, u16 maxlen)
363363

364364
av_for_each_entry(ses, av) {
365365
len = AV_LEN(av);
366-
if (AV_TYPE(av) != type)
366+
if (AV_TYPE(av) != type || !len)
367367
continue;
368368
if (!IS_ALIGNED(len, sizeof(__le16))) {
369369
cifs_dbg(VFS | ONCE, "%s: bad length(%u) for type %u\n",

0 commit comments

Comments
 (0)