Skip to content

Commit 87afc11

Browse files
committed
ksmbd: test
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent 6f0e5a0 commit 87afc11

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

smbacl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,9 @@ static void parse_dacl(struct user_namespace *user_ns,
445445
return;
446446
}
447447

448+
if (le16_to_cpu(pdacl->size) < sizeof(struct smb_acl))
449+
return;
450+
448451
ksmbd_debug(SMB, "DACL revision %d size %d num aces %d\n",
449452
le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size),
450453
le32_to_cpu(pdacl->num_aces));
@@ -456,7 +459,7 @@ static void parse_dacl(struct user_namespace *user_ns,
456459
if (num_aces <= 0)
457460
return;
458461

459-
if (num_aces > ULONG_MAX / sizeof(struct smb_ace *))
462+
if (num_aces > (le16_to_cpu(pdacl->size) - sizeof(struct smb_acl)) / sizeof(struct smb_ace *))
460463
return;
461464

462465
ret = init_acl_state(&acl_state, num_aces);

0 commit comments

Comments
 (0)