- /* Remove trailing slash if one exists. FIXME: Is there a better way to
- do this? */
- else if (upath.Length > 3 * sizeof (WCHAR) && upath.Buffer[upath.Length] == L'\\')
- upath.Length -= sizeof (WCHAR);
+ else
+ {
+ PWSTR eoBuffer = upath.Buffer + (upath.Length / sizeof (WCHAR));
+ /* Remove trailing slash if one exists. FIXME: Is there a better way to
+ do this? */
+ if ((eoBuffer - upath.Buffer) > 3 && eoBuffer[-1] == L'\\')
+ upath.Length -= sizeof (WCHAR);
+ }