smb/server: reject embedded NULs in EA names
Subsystems (2)
ChenXiaoSong
reviewerPATCH 1/1 smb/server: reject embedded NULs in EA names
From: ChenXiaoSong <[email protected]>
A client can send "DOSATTRIB\0suffix" as an EA name. The check sees a name longer than "DOSATTRIB" and lets it through. But the VFS stops at the first '\0', so the request writes to "user.DOSATTRIB", which should be blocked.
Fixes e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Signed-off-by ChenXiaoSong <[email protected]>
--- fs/smb/server/smb2pdu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/smb/server/smb2pdu.c +2 -1
@@ -3455,7 +3455,8 @@ static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len,if (!eabuf->EaNameLength) goto next; -if (eabuf->name[eabuf->EaNameLength]) { +if (eabuf->name[eabuf->EaNameLength] || +memchr (eabuf->name,'\0' , eabuf->EaNameLength)) { rc = -EBADMSG ;break ; }
Signature · 1 line
2.55.0