Skip to contentSkip to conversation

SUNRPC: Fix xdr_decode_string_inplace() argument signage

PATCH In review Chuck Lever 2 participants 2 messages Oct 26, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 6/27 SUNRPC: Fix xdr_decode_string_inplace() argument signage

xdr_decode_string_inplace() compares an incoming length to a maximum length allowed by the protocol. Make sure both sides of the comparison have the same sign.

---

 include/linux/sunrpc/xdr.h |    3 ++-
 net/sunrpc/xdr.c           |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
include/linux/sunrpc/xdr.h +2 -1
index 0751c94..9ddae63 100644
@@ -112,7 +112,8 @@ struct xdr_buf {
 __be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len);
 __be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len);
 __be32 *xdr_encode_string(__be32 *p, const char *s);
-__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen);
+__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp,
+				  unsigned int maxlen);
 __be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *);
 __be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *);
 
net/sunrpc/xdr.c +1 -1
index 3d1f7cd..ff16bab 100644
@@ -93,7 +93,7 @@ xdr_encode_string(__be32 *p, const char *string)
 }
 
 __be32 *
-xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen)
+xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, unsigned int maxlen)
 {
 	unsigned int	len;
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#1 lore raw
Quoted 30 lines · Chuck Lever

xdr_decode_string_inplace() compares an incoming length to a maximum length allowed by the protocol. Make sure both sides of the comparison have the same sign.

---

 include/linux/sunrpc/xdr.h |    3 ++-
 net/sunrpc/xdr.c           |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
include/linux/sunrpc/xdr.h +2 -1
index 0751c94..9ddae63 100644
@@ -112,7 +112,8 @@ struct xdr_buf {
 __be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len);
 __be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len);
 __be32 *xdr_encode_string(__be32 *p, const char *s);
-__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen);
+__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp,
+				  unsigned int maxlen);
 __be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *);
 __be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *);
 
net/sunrpc/xdr.c +0 -0
index 3d1f7cd..ff16bab 100644

net/sunrpc/xdr.c xdr_encode_string(__be32 *p, const char *string) · line 98

Quoted 7 lines
net/sunrpc/xdr.c +1 -1
@@ -93,7 +93,7 @@ xdr_encode_string(__be32 *p, const char *string)
 }
 
 __be32 *
-xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen)
+xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, unsigned int maxlen)
 {
 	unsigned int	len;

Nope. maxlen should be of the same type as *lenp.

Trond

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs