From dd9f90f64fedfda338bc502af71d9c63bed2d226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A1ndor=20Istv=C3=A1n=20Kr=C3=A1cser?= Date: Wed, 8 May 2024 09:20:47 +0200 Subject: [PATCH] ignore trailing slash in share path --- mgmt/share_config.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mgmt/share_config.c b/mgmt/share_config.c index a2f0a2edc..b81cee06a 100644 --- a/mgmt/share_config.c +++ b/mgmt/share_config.c @@ -165,8 +165,14 @@ static struct ksmbd_share_config *share_config_request(struct unicode_map *um, share->path = kstrndup(ksmbd_share_config_path(resp), path_len, GFP_KERNEL); - if (share->path) + if (share->path) { share->path_sz = strlen(share->path); + if (share->path_sz > 1 && share->path[share->path_sz - 1] == '/') + { + share->path[share->path_sz - 1] = '\0'; + share->path_sz--; + } + } share->create_mask = resp->create_mask; share->directory_mask = resp->directory_mask; share->force_create_mode = resp->force_create_mode;