BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / commit / 77a8df88b03707e14f840df6b0daeb9fa081f613 / vfs / mount.c

// Related

Nucleus

Barry FS Object wrapper functions 77a8df8 (3 years, 3 months ago)
diff --git a/vfs/mount.c b/vfs/mount.c
index 472b30f..53bdab2 100644
--- a/vfs/mount.c
+++ b/vfs/mount.c
@@ -3,7 +3,9 @@
  * mount system call.
  */
 
+#include <string.h>
 #include <errno.h>
+#include <nucleus/memory.h>
 #include <nucleus/task.h>
 #include <nucleus/vfs.h>
 #include "namespace.h"
@@ -16,6 +18,13 @@ int
 mount(const char *src, const char *target, const char *type,
       unsigned long flags, void *data)
 {
+	if (!verify_access(src, strnlen(src, PATH_MAX), PROT_READ))
+		return -EFAULT;
+	if (!verify_access(target, strnlen(target, PATH_MAX), PROT_READ))
+		return -EFAULT;
+	if (!verify_access(type, strnlen(type, 16), PROT_READ))
+		return -EFAULT;
+
 	Inode *mnt = NULL;
 	int res = mount_fstype(type, flags, src, data, &mnt);
 	if (res < 0)