Subject: Re: Bug: tc filter show .... raise segfault if more than one rule with action -j MARK exist

From: Stephen Hemminger <[email-masked]>
Date: Fri, 9 May 2014 13:34:24 -0700

On Thu, 08 May 2014 13:48:19 +0200
Andreas Greve <[email-masked]> wrote:

> +	/* 
> +	   clone tcipt_globals because .opts and .options_offset  will be modified later and not 
> +           restored by iptables. If tcipt_globals is not cloned the modification tcipt_globals will 
> +           cause a segmentation fault if more than one filter rule  with action -j  exists.
> +        */
> +	struct xtables_globals tmp_tcipt_globals;
> +	memcpy (&tmp_tcipt_globals, &tcipt_globals, sizeof(struct xtables_globals) );
> +

Please use structure assignment instead of memcpy().
Structure assignment makes sure that types match. mempcpy does not.