Re: [PATCH] connman : Add null check in prepare_target to avoid SIG=6
Michael Nazzareno Trimarchi <[email protected]> Mon, 2 Jun 2025 09:38:27 +0200
| Newsgroups | dev.linux.lists.connman |
|---|---|
| Message-ID | <CAOf5uw=4iJ3UoeR9JTRoFY16Tao9mEi2sZHO0=ZG1f_cvA=nyQ@mail.gmail.com> |
Hi On Mon, Jun 2, 2025 at 8:49 AM Shailesh Rathod/LGSI GPOS Dev <[email protected]> wrote: > > From: Shailesh Rathod <[email protected]> > Date: Wed, 23 Apr 2025 17:48:14 +0900 > > Add null check in prepare_target to avoid SIG=6 > > When Ethernet is connected and an attempt is made to enable the SoftAP, > a SIGSEGV (signal 6) is observed.To prevent this, add a null check to > avoid the segmentation fault. > > Signed-off-by: Shailesh Rathod<[email protected]> > --- > src/iptables.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/src/iptables.c b/src/iptables.c > index a81a077..54e04d3 100644 > --- a/src/iptables.c > +++ b/src/iptables.c > @@ -2746,20 +2746,21 @@ static struct xtables_target *prepare_target(struct connman_iptables *table, > > switch (table->type) { > case AF_INET: > - if (xt_t->x6_options) > + if (xt_t->x6_options && xt_t->option_offset){ > iptables_globals.opts = > xtables_options_xfrm( > iptables_globals.orig_opts, > iptables_globals.opts, > xt_t->x6_options, > &xt_t->option_offset); Option offset is only an offset to the options. It's not a pointer to anything I think that this need a better explanation Michael > - else > + }else if(xt_t->extra_opts && xt_t->option_offset){ > iptables_globals.opts = > xtables_merge_options( > iptables_globals.orig_opts, > iptables_globals.opts, > xt_t->extra_opts, > &xt_t->option_offset); > + } > > if (!iptables_globals.opts) { > g_free(xt_t->t); > @@ -2768,21 +2769,21 @@ static struct xtables_target *prepare_target(struct connman_iptables *table, > > break; > case AF_INET6: > - if (xt_t->x6_options) > + if (xt_t->x6_options && xt_t->option_offset){ > ip6tables_globals.opts = > xtables_options_xfrm( > ip6tables_globals.orig_opts, > ip6tables_globals.opts, > xt_t->x6_options, > &xt_t->option_offset); > - else > + }else if(xt_t->extra_opts && xt_t->option_offset){ > ip6tables_globals.opts = > xtables_merge_options( > ip6tables_globals.orig_opts, > ip6tables_globals.opts, > xt_t->extra_opts, > &xt_t->option_offset); > - > + } > if (!ip6tables_globals.opts) { > g_free(xt_t->t); > xt_t = NULL; > -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com