Commit ba038648 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: fix parsing of hostname in dfs referrals

The DFS referral parsing code does a memchr() call to find the '\\'
delimiter that separates the hostname in the referral UNC from the
sharename. It then uses that value to set the length of the hostname via
pointer subtraction.  Instead of subtracting the start of the hostname
however, it subtracts the start of the UNC, which causes the code to
pass in a hostname length that is 2 bytes too long.

Regression introduced in commit 1a4240f4.
Reported-and-Tested-by: default avatarRobbert Kouprie <>
Signed-off-by: default avatarJeff Layton <>
Cc: Wang Lei <>
Cc: David Howells <>
Signed-off-by: default avatarSteve French <>
parent 476428f8
......@@ -66,7 +66,7 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
/* Search for server name delimiter */
sep = memchr(hostname, '\\', len);
if (sep)
len = sep - unc;
len = sep - hostname;
cFYI(1, "%s: probably server name is whole unc: %s",
__func__, unc);
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