Le lundi 12 mars 2007 20:28, James Carlson a écrit :
> Julien Laganier writes:
> > It's not the problem of the OS or its ABI compatibility
> > if you insist on linking software compiled on the new
> > OS with outdated libraries supporting the old OS.
>
> Actually, in thinking about it a bit more, I think the real problem
> is with a strange usage case -- copying the addrinfo structure inside
> a library will lead to a garbage result.

Or the other way, a rebuilt library against a non rebuilt software would 
yield to an out-of-bound memory read, as the library source code won't 
know to check for AI_EXTFLAGS bit and withdraw some bytes from sizeoz() 
if it's not set -- Currently, POSIX says this about the *hints* 
parameter:

"If the argument hints is not null, it refers to a structure containing 
input values that may direct the operation by providing options and by 
limiting the returned information to a specific socket type, address 
family and/or protocol. In this hints structure every member other than 
ai_flags, ai_family, ai_socktype and ai_protocol must be zero or a null 
pointer."

All of this four fields are integer and hence valid candidates for 
memory coypying, same (in general) for zeros/NULL. Maybe, instead of 
plain memory copy, one should memset, and copy any of the four allowed 
parameters. That makes no difference to my test case though, the 
AI_EXTFLAGS will be incorrectly passed through all the same, and the 
same error will occur afterward.

So there is a known, if minor, problem, and a very low cost solution: 
Two new APIs and one struct (there are >1000 anyway). Also, 
generic/system-wide source address selection should and will be relied 
upon by most software. IMHO, better put the burden on those that use 
it, than on everything else.

Regards,

-- 
Rémi Denis-Courmont
http://www.remlab.net/

--------------------------------------------------------------------
IETF IPv6 working group mailing list
ipv6@ietf.org
Administrative Requests: https://www1.ietf.org/mailman/listinfo/ipv6
--------------------------------------------------------------------

Reply via email to