glibc: inet6_rth_init returned an abnormal address?

wangyufen wangyufen@huawei.com
Fri Dec 12 02:13:00 GMT 2014


On 2014/12/11 18:41, Ondřej Bílka wrote:
> On Thu, Dec 11, 2014 at 05:29:48PM +0800, wangyufen wrote:
>> Hi,
>>
>> I did some test on inet6_rth_init, inet6_rth_init returnned a invalid address;
>> But I used inet6_rth_init_ww (the same implementation as inet6_rth_init) in my test code, It returnned a valid address.
>> Dose anyone konw why?
>>
> Because you used implicit prototype. Compiler then assumes that prototype is
> 
> int inet6_rth_init (void *bp, socklen_t bp_len, int type, int segments)
> 
> and then sign-extends result, creating invalid pointer.
> 
> 
Thanks for your reply, then in order to obtain a valid address,  how to use inet6_rth_init?


thanks,
Wang




More information about the Libc-alpha mailing list