Commit 8735c7c8 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag '6.7rc7-smb3-srv-fix' of git://git.samba.org/ksmbd

Pull ksmbd server fix from Steve French:

 - address possible slab out of bounds in parsing of open requests

* tag '6.7rc7-smb3-srv-fix' of git://git.samba.org/ksmbd:
  ksmbd: fix slab-out-of-bounds in smb_strndup_from_utf16()
parents 505e701c d10c7787
...@@ -106,16 +106,25 @@ static int smb2_get_data_area_len(unsigned int *off, unsigned int *len, ...@@ -106,16 +106,25 @@ static int smb2_get_data_area_len(unsigned int *off, unsigned int *len,
break; break;
case SMB2_CREATE: case SMB2_CREATE:
{ {
unsigned short int name_off =
le16_to_cpu(((struct smb2_create_req *)hdr)->NameOffset);
unsigned short int name_len =
le16_to_cpu(((struct smb2_create_req *)hdr)->NameLength);
if (((struct smb2_create_req *)hdr)->CreateContextsLength) { if (((struct smb2_create_req *)hdr)->CreateContextsLength) {
*off = le32_to_cpu(((struct smb2_create_req *) *off = le32_to_cpu(((struct smb2_create_req *)
hdr)->CreateContextsOffset); hdr)->CreateContextsOffset);
*len = le32_to_cpu(((struct smb2_create_req *) *len = le32_to_cpu(((struct smb2_create_req *)
hdr)->CreateContextsLength); hdr)->CreateContextsLength);
break; if (!name_len)
break;
if (name_off + name_len < (u64)*off + *len)
break;
} }
*off = le16_to_cpu(((struct smb2_create_req *)hdr)->NameOffset); *off = name_off;
*len = le16_to_cpu(((struct smb2_create_req *)hdr)->NameLength); *len = name_len;
break; break;
} }
case SMB2_QUERY_INFO: case SMB2_QUERY_INFO:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment