kern/117010: [linux] linux_getdents() get somethinng like buffer
overflow
Chagin Dmitry
chagin.dmitry at gmail.com
Fri Jul 25 07:00:16 UTC 2008
The following reply was made to PR kern/117010; it has been noted by GNATS.
From: Chagin Dmitry <chagin.dmitry at gmail.com>
To: bug-followup at freebsd.org, samflanker at gmail.com
Cc:
Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer
overflow
Date: Fri, 25 Jul 2008 10:22:46 +0400 (MSD)
Please, try a patch below:
diff --git a/src/sys/compat/linux/linux_file.c b/src/sys/compat/linux/linux_file
index 303bc3f..d88f95f 100644
--- a/src/sys/compat/linux/linux_file.c
+++ b/src/sys/compat/linux/linux_file.c
@@ -303,8 +303,8 @@ struct l_dirent64 {
char d_name[LINUX_NAME_MAX + 1];
};
-#define LINUX_RECLEN(de,namlen) \
- ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + 1))
+#define LINUX_RECLEN(de,namlen,trail) \
+ ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + trail))
#define LINUX_DIRBLKSIZ 512
@@ -436,8 +436,8 @@ again:
}
linuxreclen = (is64bit)
- ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen)
- : LINUX_RECLEN(&linux_dirent, bdp->d_namlen);
+ ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen, 1)
+ : LINUX_RECLEN(&linux_dirent, bdp->d_namlen, 2);
if (reclen > len || resid < linuxreclen) {
outp++;
it solves getdents() problem (at least at x86_64 emulation with
linux_base-f8)
ps, be not bared, linux really has such features...
thnx!
--
Have fun!
chd
More information about the freebsd-emulation
mailing list