Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs nfs: Use unsigned name lengths so we don't trip over...
details: https://anonhg.NetBSD.org/src/rev/32c0297631e9
branches: trunk
changeset: 374003:32c0297631e9
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Mar 23 19:52:52 2023 +0000
description:
nfs: Use unsigned name lengths so we don't trip over negative ones.
- nfsm_strsiz is only used with uint32_t in callers, but let's not
leave it as a rake to step on.
- nfsm_srvnamesiz is abused with signed s. The internal conversion
to unsigned serves to reject both negative and too-large values in
such callers.
XXX Should make all callers use unsigned, rather than flipping back
and forth between signed and unsigned for name lengths.
XXX pullup-8
XXX pullup-9
XXX pullup-10
diffstat:
sys/nfs/nfsm_subs.h | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (28 lines):
diff -r 1c3974da7422 -r 32c0297631e9 sys/nfs/nfsm_subs.h
--- a/sys/nfs/nfsm_subs.h Thu Mar 23 19:52:42 2023 +0000
+++ b/sys/nfs/nfsm_subs.h Thu Mar 23 19:52:52 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfsm_subs.h,v 1.56 2023/03/23 19:52:33 riastradh Exp $ */
+/* $NetBSD: nfsm_subs.h,v 1.57 2023/03/23 19:52:52 riastradh Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -366,7 +366,7 @@
#define nfsm_strsiz(s,m) \
{ nfsm_dissect(tl,uint32_t *,NFSX_UNSIGNED); \
- if (((s) = fxdr_unsigned(uint32_t,*tl)) > (m)) { \
+ if ((uint32_t)((s) = fxdr_unsigned(uint32_t,*tl)) > (m)) { \
m_freem(mrep); \
error = EBADRPC; \
goto nfsmout; \
@@ -374,7 +374,8 @@
#define nfsm_srvnamesiz(s) \
{ nfsm_dissect(tl,uint32_t *,NFSX_UNSIGNED); \
- if (((s) = fxdr_unsigned(uint32_t,*tl)) > NFS_MAXNAMLEN) \
+ if ((uint32_t)((s) = fxdr_unsigned(uint32_t,*tl)) > \
+ NFS_MAXNAMLEN) \
error = NFSERR_NAMETOL; \
if (error) \
nfsm_reply(0); \
Home |
Main Index |
Thread Index |
Old Index