diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-12-24 16:53:21 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-12-24 16:53:21 +0000 |
commit | 261ca79adc4eed000e7c385a1759a9815784a50f (patch) | |
tree | 48c24f3addc1c936018d16abf1c6c229846f5584 /sys/nfs | |
parent | 83f103f8185c7c5e6d51aabe81f80de9eafa004d (diff) |
Low hanging macro fruit. Inline the nfsm_srvstrsiz macro since
its used only once and nuke its definition.
Stolen from blambert's bag'o'diffs.
OK blambert@.
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_serv.c | 11 | ||||
-rw-r--r-- | sys/nfs/nfsm_subs.h | 9 |
2 files changed, 10 insertions, 10 deletions
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 2f2320e6361..549998b1fa4 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_serv.c,v 1.59 2008/12/24 02:43:52 thib Exp $ */ +/* $OpenBSD: nfs_serv.c,v 1.60 2008/12/24 16:53:20 thib Exp $ */ /* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */ /* @@ -537,7 +537,14 @@ nfsrv_read(nfsd, slp, procp, mrq) nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); off = (off_t)fxdr_unsigned(u_int32_t, *tl); } - nfsm_srvstrsiz(reqlen, NFS_SRVMAXDATA(nfsd)); + + nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); + reqlen = fxdr_unsigned(int32_t, *tl); + if (reqlen > (NFS_SRVMAXDATA(nfsd)) || reqlen <= 0) { + error = EBADRPC; + nfsm_reply(0); + } + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(2 * NFSX_UNSIGNED); diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h index debd07f01c2..54014291aca 100644 --- a/sys/nfs/nfsm_subs.h +++ b/sys/nfs/nfsm_subs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsm_subs.h,v 1.31 2008/06/15 04:03:40 thib Exp $ */ +/* $OpenBSD: nfsm_subs.h,v 1.32 2008/12/24 16:53:20 thib Exp $ */ /* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */ /* @@ -194,13 +194,6 @@ goto nfsmout; \ } } -#define nfsm_srvstrsiz(s,m) \ - { nfsm_dissect(tl,u_int32_t *,NFSX_UNSIGNED); \ - if (((s) = fxdr_unsigned(int32_t,*tl)) > (m) || (s) <= 0) { \ - error = EBADRPC; \ - nfsm_reply(0); \ - } } - #define nfsm_srvnamesiz(s) \ { nfsm_dissect(tl,u_int32_t *,NFSX_UNSIGNED); \ if (((s) = fxdr_unsigned(int32_t,*tl)) > NFS_MAXNAMLEN) \ |