Commit c34fea5a authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French

cifs: Skip any trailing backslashes from UNC

When extracting hostname from UNC, check for leading backslashes
before trying to remove them.
Signed-off-by: default avatarPaulo Alcantara <palcantara@suse.de>
Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 56c762eb
...@@ -1044,7 +1044,12 @@ extract_hostname(const char *unc) ...@@ -1044,7 +1044,12 @@ extract_hostname(const char *unc)
/* skip double chars at beginning of string */ /* skip double chars at beginning of string */
/* BB: check validity of these bytes? */ /* 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 */ /* delimiter between hostname and sharename is always '\\' now */
delim = strchr(src, '\\'); delim = strchr(src, '\\');
......
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