mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 18:56:24 +00:00
cifs: Skip any trailing backslashes from UNC
When extracting hostname from UNC, check for leading backslashes before trying to remove them. Signed-off-by: Paulo Alcantara <palcantara@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
56c762eb9b
commit
c34fea5a63
@ -1044,7 +1044,12 @@ extract_hostname(const char *unc)
|
||||
|
||||
/* skip double chars at beginning of string */
|
||||
/* BB: check validity of these bytes? */
|
||||
src = unc + 2;
|
||||
if (strlen(unc) < 3)
|
||||
return ERR_PTR(-EINVAL);
|
||||
for (src = unc; *src && *src == '\\'; src++)
|
||||
;
|
||||
if (!*src)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
/* delimiter between hostname and sharename is always '\\' now */
|
||||
delim = strchr(src, '\\');
|
||||
|
Loading…
x
Reference in New Issue
Block a user