Skip to content

Commit d1683ac

Browse files
Casey Bodleyunknown
authored andcommitted
mount: fix remote name parsing to allow ipv6 addrs
instead of searching for the first :, use strrchr to find the last Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
1 parent 21a4fdd commit d1683ac

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

mount/mount.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,6 @@ static void ConvertUnixSlashes(
203203
*pos = TEXT('\\');
204204
}
205205

206-
static LPTSTR FindEndOfServer(
207-
IN LPTSTR pRemoteName)
208-
{
209-
LPTSTR pos = pRemoteName;
210-
while (*pos && *pos != TEXT(':'))
211-
pos++;
212-
return pos;
213-
}
214-
215206
static DWORD ParseRemoteName(
216207
IN LPTSTR pRemoteName,
217208
IN OUT PMOUNT_OPTION_LIST pOptions,
@@ -222,10 +213,10 @@ static DWORD ParseRemoteName(
222213
LPTSTR pEnd;
223214

224215
ConvertUnixSlashes(pRemoteName);
225-
pEnd = FindEndOfServer(pRemoteName);
226216

227217
/* fail if the server name doesn't end with :\ */
228-
if (*pEnd == 0 || pEnd[0] != TEXT(':') || pEnd[1] != TEXT('\\')) {
218+
pEnd = _tcsrchr(pRemoteName, TEXT(':'));
219+
if (pEnd == NULL || pEnd[1] != TEXT('\\')) {
229220
_ftprintf(stderr, TEXT("Failed to parse the remote path. ")
230221
TEXT("Expected 'hostname:\\path'.\n"));
231222
result = ERROR_BAD_ARGUMENTS;

0 commit comments

Comments
 (0)