summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/mount.c
diff options
context:
space:
mode:
authordzwdz2021-08-27 19:36:37 +0200
committerdzwdz2021-08-27 19:36:37 +0200
commita5bd09d5a995400c4f4ec1270e1ad380d238783c (patch)
tree7feffaf5ad13308a792481a77fa868cbd58b7917 /src/kernel/vfs/mount.c
parentaa3ce9383da78a83b64160d5c64ecd077d0b36ef (diff)
make vfs_mount_resolve pass all the tests
Diffstat (limited to 'src/kernel/vfs/mount.c')
-rw-r--r--src/kernel/vfs/mount.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/kernel/vfs/mount.c b/src/kernel/vfs/mount.c
index bf98957..bd06370 100644
--- a/src/kernel/vfs/mount.c
+++ b/src/kernel/vfs/mount.c
@@ -21,7 +21,16 @@ struct vfs_mount *vfs_mount_resolve(
for (; top; top = top->prev) {
if (top->prefix_len > path_len)
continue;
- if (memcmp(top->prefix, path, top->prefix_len) == 0)
+ if (memcmp(top->prefix, path, top->prefix_len) != 0)
+ continue;
+
+ /* ensure that there's no garbage after the match
+ * recognize that e.g. /thisasdf doesn't get recognized as mounted under
+ * /this */
+
+ if (top->prefix_len == path_len) // can't happen if prefix == path
+ break;
+ if (path[top->prefix_len] == '/')
break;
}
return top;