Skip to content

Commit

Permalink
ksmbd: test
Browse files Browse the repository at this point in the history
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
namjaejeon committed Feb 9, 2025
1 parent 6f0e5a0 commit 87afc11
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion smbacl.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,9 @@ static void parse_dacl(struct user_namespace *user_ns,
return;
}

if (le16_to_cpu(pdacl->size) < sizeof(struct smb_acl))
return;

ksmbd_debug(SMB, "DACL revision %d size %d num aces %d\n",
le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size),
le32_to_cpu(pdacl->num_aces));
Expand All @@ -456,7 +459,7 @@ static void parse_dacl(struct user_namespace *user_ns,
if (num_aces <= 0)
return;

if (num_aces > ULONG_MAX / sizeof(struct smb_ace *))
if (num_aces > (le16_to_cpu(pdacl->size) - sizeof(struct smb_acl)) / sizeof(struct smb_ace *))
return;

ret = init_acl_state(&acl_state, num_aces);
Expand Down

0 comments on commit 87afc11

Please sign in to comment.