From owner-p4-projects@FreeBSD.ORG Mon Sep 28 10:37:00 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 992F5106568F; Mon, 28 Sep 2009 10:37:00 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DC07106568B for ; Mon, 28 Sep 2009 10:37:00 +0000 (UTC) (envelope-from gk@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4C35B8FC08 for ; Mon, 28 Sep 2009 10:37:00 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n8SAb0lU063447 for ; Mon, 28 Sep 2009 10:37:00 GMT (envelope-from gk@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n8SAb0Vi063445 for perforce@freebsd.org; Mon, 28 Sep 2009 10:37:00 GMT (envelope-from gk@FreeBSD.org) Date: Mon, 28 Sep 2009 10:37:00 GMT Message-Id: <200909281037.n8SAb0Vi063445@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gk@FreeBSD.org using -f From: Gleb Kurtsou To: Perforce Change Reviews Cc: Subject: PERFORCE change 168971 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2009 10:37:00 -0000 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 #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);