PERFORCE change 168971 for review
Gleb Kurtsou
gk at FreeBSD.org
Mon Sep 28 10:37:00 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=168971
Change 168971 by gk at 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);
More information about the p4-projects
mailing list