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

Kevin P. Fleming kpfleming at digium.com
Thu Jul 8 10:40:15 CDT 2010


On 07/08/2010 10:34 AM, SVN commits to the Asterisk project wrote:
> Author: simon.perreault
> Date: Thu Jul  8 10:34:30 2010
> New Revision: 274766
> 
> URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=274766
> Log:
> Fixed another pointer issue
> 
> Modified:
>     team/group/v6-new/main/netsock2.c
> 
> Modified: team/group/v6-new/main/netsock2.c
> URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/main/netsock2.c?view=diff&rev=274766&r1=274765&r2=274766
> ==============================================================================
> --- team/group/v6-new/main/netsock2.c (original)
> +++ team/group/v6-new/main/netsock2.c Thu Jul  8 10:34:30 2010
> @@ -489,7 +489,7 @@
>  
>  void ast_sockaddr_from_sin(struct ast_sockaddr *addr, const struct sockaddr_in *sin)
>  {
> -	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().

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kfleming at digium.com
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list