/* Finally, skip multiple slashes. */
while (slash != path) {
- if (*slash != '/')
+ if (*(slash - 1) != '/')
break;
--slash;
*basename = path;
} else {
if (directory)
- *directory = talloc_strndup (ctx, path, slash - path + 1);
+ *directory = talloc_strndup (ctx, path, slash - path);
}
return NOTMUCH_STATUS_SUCCESS;