Subject: Re: new rpc code: what am I doing wrong ?
To: None <itojun@iijlab.net>
From: Jason R Thorpe <thorpej@zembu.com>
List: current-users
Date: 06/12/2000 18:04:14
On Tue, Jun 13, 2000 at 09:28:56AM +0900, itojun@iijlab.net wrote:

 > 	free_grp() tries to free things too much.   freeaddrinfo() takes
 > 	care of recursive struct.  the patch also corrects possible memory leak.

There's another problem -- libc/rpc is returning fields uninitialized.
They can contain garbage, so strdup() can trip over them, etc:

(gdb) print *tcptransp
$5 = {xp_fd = 8, xp_port = 65535, xp_ops = 0x1604f2998, 
  xp_addrlen = -791621424, xp_raddr = {sin_len = 208 'Ð', 
    sin_family = 208 'Ð', sin_port = 53456, sin_addr = {s_addr = -791621424}, 
    sin_zero = "ÐÐÐÐÐÐÐÐ"}, xp_ops2 = 0x1604f29c8, xp_tp = 0x0, 
  xp_netid = 0xd0d0d0d0d0d0d0d0 "", xp_ltaddr = {maxlen = 16, len = 16, 
    buf = 0x120116220}, xp_rtaddr = {maxlen = 128, len = -791621424, 
    buf = 0xd0d0d0d0d0d0d0d0}, xp_verf = {oa_flavor = 0, oa_base = 0x0, 
    oa_length = 0}, xp_p1 = 0x120116210, xp_p2 = 0x0, xp_p3 = 0x0, 
  xp_type = -791621424}
(gdb)  

I've just commited a fix for this part.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>