Fix #PF in ext2 vfs
diff --git a/src/kernel/dri/fs/ext2/ext2_vfs.c b/src/kernel/dri/fs/ext2/ext2_vfs.c
index d5c8d3f..ef99d02 100644
--- a/src/kernel/dri/fs/ext2/ext2_vfs.c
+++ b/src/kernel/dri/fs/ext2/ext2_vfs.c
@@ -142,9 +142,9 @@
 	{
 	}
 
-	if (i == index)
+	if (dent && i == index)
 	{
-		memcpy(dirent->name, dent->name, 256);
+		memcpy(dirent->name, dent->name, MAX(dent->name_len, FS_MAX_NAME_LEN));
 		dirent->name_len = dent->name_len;
 		dirent->inode = dent->inode;
 
@@ -196,8 +196,8 @@
 	struct ext2_fs_dirent *dent =
 		malloc(sizeof(struct ext2_fs_dirent));
 
-	if (strncmp(".", name, name_len) == 0 ||
-		strncmp("..", name, name_len) == 0)
+	if (strncmp(".", (char *)name, name_len) == 0 ||
+		strncmp("..", (char *)name, name_len) == 0)
 	{
 		return true;
 	}