Skip to content

Commit 46d9039

Browse files
committed
Update xtoptions.c
1 parent ab6d8bc commit 46d9039

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

ipthelper/xtoptions.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,13 @@ xtables_options_xfrm(struct option *orig_opts, struct option *oldopts,
120120
memcpy(mp, oldopts, sizeof(*mp) * num_old);
121121
mp += num_old;
122122
}
123-
xtables_free_opts(0);
123+
/*
124+
* The helper ships a static original_opts array. Guard against
125+
* xtables_free_opts() attempting to release it, which would provoke
126+
* the invalid free() observed under multi-threaded use.
127+
*/
128+
if (xt_params->opts != NULL && xt_params->opts != xt_params->orig_opts)
129+
xtables_free_opts(0);
124130

125131
/* Clear trailing entry */
126132
memset(mp, 0, sizeof(*mp));

0 commit comments

Comments
 (0)