[asterisk-dev] [asterisk-commits] simon.perreault: branch group/v6-new r274766 - /team/group/v6-new/main/

Simon Perreault simon.perreault at viagenie.ca
Thu Jul 8 11:35:35 CDT 2010


On 2010-07-08 11:40, Kevin P. Fleming wrote:
>> -	memcpy(&addr->ss, &sin, sizeof(*sin));
>> +	memcpy(&addr->ss, sin, sizeof(*sin));
>>  
>>  	if (addr->ss.ss_family != AF_INET) {
>>  		ast_log(LOG_DEBUG, "Address family is not AF_INET\n");
>>
> 
> Problems of this type could be avoided completely by making the
> ast_sockaddr structure 'ss' member a union of the various types of
> sockaddr structures you intend to store there and then using direct
> structure assignments instead of memcpy().

You're right, this would be one advantage of using a union.

As Tilghman pointed out, using a union was already suggested to us. See
our reply here:
https://reviewboard.asterisk.org/r/743/#comment_rc4803-2290

Simon
-- 
NAT64/DNS64 open-source --> http://ecdysis.viagenie.ca
STUN/TURN server        --> http://numb.viagenie.ca
vCard 4.0               --> http://www.vcarddav.org



More information about the asterisk-dev mailing list