Module Name: src
Committed By: dholland
Date: Mon Feb 25 06:00:40 UTC 2019
Modified Files:
src/sys/ufs/ufs: ufs_vnops.c
Log Message:
Revert -r1.244-245 of ufs_vnops.c; they are wrong.
Fix the mistake in -r1.243 that made them look like reasonable changes.
(this does not affect whether the -r1.243 change works with the union
mount path in libc, but fixes an immediate hazard)
To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 src/sys/ufs/ufs/ufs_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.245 src/sys/ufs/ufs/ufs_vnops.c:1.246
--- src/sys/ufs/ufs/ufs_vnops.c:1.245 Mon Feb 25 00:51:24 2019
+++ src/sys/ufs/ufs/ufs_vnops.c Mon Feb 25 06:00:40 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_vnops.c,v 1.245 2019/02/25 00:51:24 christos Exp $ */
+/* $NetBSD: ufs_vnops.c,v 1.246 2019/02/25 06:00:40 dholland Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.245 2019/02/25 00:51:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.246 2019/02/25 06:00:40 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -1246,7 +1246,7 @@ ufs_readdir(void *v)
size_t numcookies, maxcookies;
/* disk buffer */
off_t physstart, physend;
- size_t skipstart;
+ size_t skipstart, dropend;
char *rawbuf;
size_t rawbufmax, rawbytes;
struct uio rawuio;
@@ -1277,11 +1277,13 @@ ufs_readdir(void *v)
}
skipstart = startoffset - physstart;
+ dropend = endoffset - physend;
/* how much to actually read */
rawbufmax = callerbytes + skipstart;
if (rawbufmax < callerbytes)
return EINVAL;
+ rawbufmax -= dropend;
if (rawbufmax < _DIRENT_MINSIZE(rawdp)) {
/* no room for even one struct direct */