Re: Possible bug in nfs-utils source.

Ben Greear
2009-01-22T00:00:34Z

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

Chuck Lever wrote:
> On Jan 21, 2009, at Jan 21, 2009, 5:25 PM, Ben Greear wrote:
>> I'm working on adding support to bind to local addresses, and
>> I noticed this code in nfs/getport.c
>>
>> I believe the sizeof should probably be sizeof(*lb_addr) ?
>
> Yes. Can you submit a patch to Steve and copy the list?

The patch is attached.

Signed-Off-By: Ben Greear <greearb@candelatech.com>

Thanks,
Ben

--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com

[-- Attachment #2: nfs_sizeof.patch --]
[-- Type: text/x-patch, Size: 445 bytes --]

diff --git a/support/nfs/getport.c b/support/nfs/getport.c
index 47824a2..f5f7049 100644
--- a/support/nfs/getport.c
+++ b/support/nfs/getport.c
@@ -836,7 +836,7 @@ unsigned short nfs_getlocalport(const rpcprot_t program,
{
struct sockaddr_storage address;
struct sockaddr *lb_addr = (struct sockaddr *)&address;
- socklen_t lb_len = sizeof(lb_addr);
+ socklen_t lb_len = sizeof(*lb_addr);
unsigned short port = 0;

#ifdef NFS_GP_LOCAL