summaryrefslogtreecommitdiff
path: root/sys/nfs
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2002-05-10 22:07:09 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2002-05-10 22:07:09 +0000
commite49313d29e25444826aad553d511df549b5061bc (patch)
tree19deffcfa76f09ec0544855c726cb82b70b39c0a /sys/nfs
parentd531e46cbb1c8cb61c37fe111c3d143ca6ae695f (diff)
Fix for PR2641. Length calculation was wrong in loop. Include comment
describing fixed length calculation
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/nfs_serv.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index 7c0769f4d4b..2d732c30799 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_serv.c,v 1.31 2002/04/29 07:36:32 deraadt Exp $ */
+/* $OpenBSD: nfs_serv.c,v 1.32 2002/05/10 22:07:08 csapuntz Exp $ */
/* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */
/*
@@ -2777,6 +2777,18 @@ again:
goto again;
}
+ /*
+ * struct READDIRPLUS3resok {
+ * postop_attr dir_attributes;
+ * cookieverf3 cookieverf;
+ * dirlistplus3 reply;
+ * }
+ *
+ * struct dirlistplus3 {
+ * entryplus3 *entries;
+ * bool eof;
+ * }
+ */
dirlen = len = NFSX_V3POSTOPATTR + NFSX_V3COOKIEVERF + 2 * NFSX_UNSIGNED;
nfsm_reply(cnt);
nfsm_srvpostop_attr(getret, &at);
@@ -2816,8 +2828,19 @@ again:
* exceeded, get out now. Both of these lengths
* are calculated conservatively, including all
* XDR overheads.
+ *
+ * Each entry:
+ * 2 * NFSX_UNSIGNED for fileid3
+ * 1 * NFSX_UNSIGNED for length of name
+ * nlen + rem == space the name takes up
+ * 2 * NFSX_UNSIGNED for the cookie
+ * 1 * NFSX_UNSIGNED to indicate if file handle present
+ * 1 * NFSX_UNSIGNED for the file handle length
+ * NFSX_V3FH == space our file handle takes up
+ * NFSX_V3POSTOPATTR == space the attributes take up
+ * 1 * NFSX_UNSIGNED for next pointer
*/
- len += (7 * NFSX_UNSIGNED + nlen + rem + NFSX_V3FH +
+ len += (8 * NFSX_UNSIGNED + nlen + rem + NFSX_V3FH +
NFSX_V3POSTOPATTR);
dirlen += (6 * NFSX_UNSIGNED + nlen + rem);
if (len > cnt || dirlen > fullsiz) {