Date: Mon, 28 Sep 2009 10:37:00 GMT From: Gleb Kurtsou <gk@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 168971 for review Message-ID: <200909281037.n8SAb0Vi063445@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=168971 Change 168971 by gk@gk_h1 on 2009/09/28 10:36:28 correctly check readdir buffer size Affected files ... .. //depot/projects/soc2009/gk_pefs/sys/fs/pefs/pefs_vnops.c#16 edit Differences ... ==== //depot/projects/soc2009/gk_pefs/sys/fs/pefs/pefs_vnops.c#16 (text+ko) ==== @@ -69,6 +69,7 @@ #include <fs/pefs/pefs.h> #define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN + 1)) +#define DIRENT_MAXSIZE (sizeof(struct dirent)) static int pefs_bug_bypass = 0; /* for debugging: enables bypass printf'ing */ SYSCTL_INT(_debug, OID_AUTO, pefs_bug_bypass, CTLFLAG_RW, @@ -1249,7 +1250,6 @@ puio = pefs_chunk_uio(&pc, uio->uio_offset, uio->uio_rw); error = VOP_READDIR(PEFS_LOWERVP(vp), puio, cred, eofflag, a_ncookies, a_cookies); - if (error) break; @@ -1264,7 +1264,7 @@ uio->uio_offset = puio->uio_offset; /* Finish if there is no need to merge cookies */ - if ((*eofflag || uio->uio_resid <= DIRENT_MINSIZE) && + if ((*eofflag || uio->uio_resid < DIRENT_MAXSIZE) && (a_cookies == NULL || r_cookies == NULL)) break; @@ -1290,7 +1290,7 @@ cookies = NULL; } - if (*eofflag || uio->uio_resid <= DIRENT_MINSIZE) + if (*eofflag || uio->uio_resid < DIRENT_MAXSIZE) break; pefs_chunk_restore(&pc);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909281037.n8SAb0Vi063445>