Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69208
b: refs/heads/master
c: e65fe39
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Oct 9, 2007
1 parent cc7f34b commit df591b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d66968f207b6402fd12c20145cb31dbe3608979c
refs/heads/master: e65fe3976f594603ed7b1b4a99d3e9b867f573ea
28 changes: 23 additions & 5 deletions trunk/net/sunrpc/rpcb_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,19 @@ static int rpcb_decode_getaddr(struct rpc_rqst *req, __be32 *p,

*portp = 0;
addr_len = ntohl(*p++);
if (addr_len > RPCB_MAXADDRLEN) /* sanity */
return -EINVAL;

dprintk("RPC: rpcb_decode_getaddr returned string: '%s'\n",
(char *) p);

/*
* Simple sanity check. The smallest possible universal
* address is an IPv4 address string containing 11 bytes.
*/
if (addr_len < 11 || addr_len > RPCB_MAXADDRLEN)
goto out_err;

/*
* Start at the end and walk backwards until the first dot
* is encountered. When the second dot is found, we have
* both parts of the port number.
*/
addr = (char *)p;
val = 0;
first = 1;
Expand All @@ -555,8 +562,19 @@ static int rpcb_decode_getaddr(struct rpc_rqst *req, __be32 *p,
}
}

/*
* Simple sanity check. If we never saw a dot in the reply,
* then this was probably just garbage.
*/
if (first)
goto out_err;

dprintk("RPC: rpcb_decode_getaddr port=%u\n", *portp);
return 0;

out_err:
dprintk("RPC: rpcbind server returned malformed reply\n");
return -EIO;
}

#define RPCB_program_sz (1u)
Expand Down

0 comments on commit df591b8

Please sign in to comment.