cifsd: Pass string length parameter to match_pattern()
When iterating through a directory, a file's name may not be
null-terminated (depending on the underlying filesystem implementation).
Modify match_pattern to take the string's length into account when matching
it against the request pattern.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
diff --git a/fs/cifsd/smb2pdu.c b/fs/cifsd/smb2pdu.c
index 4ec45c3..32816ba 100644
--- a/fs/cifsd/smb2pdu.c
+++ b/fs/cifsd/smb2pdu.c
@@ -3837,7 +3837,7 @@ static int __query_dir(struct dir_context *ctx,
return 0;
if (ksmbd_share_veto_filename(priv->work->tcon->share_conf, name))
return 0;
- if (!match_pattern(name, priv->search_pattern))
+ if (!match_pattern(name, namlen, priv->search_pattern))
return 0;
d_info->name = name;