Commit d17db71b by Russell Belfer

isalpha is not great for UTF-8

When checking for a drive letter on windows, instead of using
isalpha(), it is better to just check for a..z and A..Z, I think,
particularly because the MS isalpha implementation appears to
assert when given an 0xFF byte.
parent 145e696b
...@@ -170,7 +170,8 @@ int git_path_root(const char *path) ...@@ -170,7 +170,8 @@ int git_path_root(const char *path)
#ifdef GIT_WIN32 #ifdef GIT_WIN32
/* Does the root of the path look like a windows drive ? */ /* Does the root of the path look like a windows drive ? */
if (isalpha(path[0]) && (path[1] == ':')) if (((path[0] >= 'a' && path[0] <= 'z') ||
(path[0] >= 'A' && path[0] <= 'Z')) && path[1] == ':')
offset += 2; offset += 2;
/* Are we dealing with a windows network path? */ /* Are we dealing with a windows network path? */
......
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